@jupyterlite/terminal 0.2.0 → 0.2.2
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 +1 -1
- package/lib/client.d.ts +4 -0
- package/lib/client.js +15 -3
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/lib/tokens.d.ts +11 -0
- package/package.json +15 -5
- package/src/client.ts +19 -4
- package/src/index.ts +3 -0
- package/src/tokens.ts +13 -0
package/README.md
CHANGED
package/lib/client.d.ts
CHANGED
|
@@ -17,10 +17,14 @@ export declare class LiteTerminalAPIClient implements ILiteTerminalAPIClient {
|
|
|
17
17
|
readonly serverSettings: ServerConnection.ISettings;
|
|
18
18
|
startNew(options?: Terminal.ITerminal.IOptions): Promise<Terminal.IModel>;
|
|
19
19
|
listRunning(): Promise<Terminal.IModel[]>;
|
|
20
|
+
registerAlias(key: string, value: string): void;
|
|
21
|
+
registerEnvironmentVariable(key: string, value: string | undefined): void;
|
|
20
22
|
registerExternalCommand(options: IExternalCommand.IOptions): void;
|
|
21
23
|
shutdown(name: string): Promise<void>;
|
|
22
24
|
private get _models();
|
|
23
25
|
private _nextAvailableName;
|
|
26
|
+
private _aliases?;
|
|
27
|
+
private _environment?;
|
|
24
28
|
private _browsingContextId?;
|
|
25
29
|
private _externalCommands;
|
|
26
30
|
private _shellManager;
|
package/lib/client.js
CHANGED
|
@@ -39,6 +39,9 @@ export class LiteTerminalAPIClient {
|
|
|
39
39
|
baseUrl,
|
|
40
40
|
wasmBaseUrl: URLExt.join(baseUrl, 'extensions/@jupyterlite/terminal/static/wasm/'),
|
|
41
41
|
browsingContextId: this._browsingContextId,
|
|
42
|
+
aliases: this._aliases,
|
|
43
|
+
environment: this._environment,
|
|
44
|
+
externalCommands: this._externalCommands,
|
|
42
45
|
shellId: name,
|
|
43
46
|
shellManager: this._shellManager,
|
|
44
47
|
outputCallback: text => {
|
|
@@ -48,9 +51,6 @@ export class LiteTerminalAPIClient {
|
|
|
48
51
|
}
|
|
49
52
|
});
|
|
50
53
|
this._shells.set(name, shell);
|
|
51
|
-
for (const externalCommand of this._externalCommands) {
|
|
52
|
-
shell.registerExternalCommand(externalCommand);
|
|
53
|
-
}
|
|
54
54
|
// Hook to connect socket to shell.
|
|
55
55
|
const hook = async (shell, socket) => {
|
|
56
56
|
shell.socket = socket;
|
|
@@ -89,6 +89,18 @@ export class LiteTerminalAPIClient {
|
|
|
89
89
|
async listRunning() {
|
|
90
90
|
return this._models;
|
|
91
91
|
}
|
|
92
|
+
registerAlias(key, value) {
|
|
93
|
+
if (this._aliases === undefined) {
|
|
94
|
+
this._aliases = {};
|
|
95
|
+
}
|
|
96
|
+
this._aliases[key] = value;
|
|
97
|
+
}
|
|
98
|
+
registerEnvironmentVariable(key, value) {
|
|
99
|
+
if (this._environment === undefined) {
|
|
100
|
+
this._environment = {};
|
|
101
|
+
}
|
|
102
|
+
this._environment[key] = value;
|
|
103
|
+
}
|
|
92
104
|
registerExternalCommand(options) {
|
|
93
105
|
this._externalCommands.push(options);
|
|
94
106
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { JupyterFrontEndPlugin } from '@jupyterlab/application';
|
|
2
2
|
import { ServiceManagerPlugin, Terminal } from '@jupyterlab/services';
|
|
3
|
+
import { ILiteTerminalAPIClient } from './tokens';
|
|
3
4
|
declare const _default: (ServiceManagerPlugin<Terminal.ITerminalAPIClient> | ServiceManagerPlugin<Terminal.IManager> | JupyterFrontEndPlugin<void>)[];
|
|
4
5
|
export default _default;
|
|
6
|
+
export { ILiteTerminalAPIClient };
|
package/lib/index.js
CHANGED
package/lib/tokens.d.ts
CHANGED
|
@@ -11,6 +11,17 @@ export interface ILiteTerminalAPIClient extends Terminal.ITerminalAPIClient {
|
|
|
11
11
|
* Function that handles stdin requests received from service worker.
|
|
12
12
|
*/
|
|
13
13
|
handleStdin(request: IStdinRequest): Promise<IStdinReply>;
|
|
14
|
+
/**
|
|
15
|
+
* Register an alias that will be available in all terminals.
|
|
16
|
+
* If the key has already been registered, it will be overwritten.
|
|
17
|
+
*/
|
|
18
|
+
registerAlias(key: string, value: string): void;
|
|
19
|
+
/**
|
|
20
|
+
* Register an environment variable that will be available in all terminals.
|
|
21
|
+
* If the key has already been registered, it will be overwritten.
|
|
22
|
+
* A key with an undefined value will be deleted if already registered.
|
|
23
|
+
*/
|
|
24
|
+
registerEnvironmentVariable(key: string, value: string | undefined): void;
|
|
14
25
|
/**
|
|
15
26
|
* Register an external command that will be available in all terminals.
|
|
16
27
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jupyterlite/terminal",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "A terminal for JupyterLite",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jupyter",
|
|
@@ -61,9 +61,9 @@
|
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@jupyterlab/coreutils": "^6.4.3",
|
|
63
63
|
"@jupyterlab/services": "^7.4.3",
|
|
64
|
-
"@jupyterlite/cockle": "^0.1.
|
|
65
|
-
"@jupyterlite/contents": "0.6.0",
|
|
66
|
-
"@jupyterlite/server": "0.6.0",
|
|
64
|
+
"@jupyterlite/cockle": "^0.1.2",
|
|
65
|
+
"@jupyterlite/contents": "^0.6.0",
|
|
66
|
+
"@jupyterlite/server": "^0.6.0",
|
|
67
67
|
"@lumino/coreutils": "^2.2.0",
|
|
68
68
|
"mock-socket": "^9.3.1"
|
|
69
69
|
},
|
|
@@ -110,7 +110,17 @@
|
|
|
110
110
|
},
|
|
111
111
|
"jupyterlab": {
|
|
112
112
|
"extension": true,
|
|
113
|
-
"outputDir": "jupyterlite_terminal/labextension"
|
|
113
|
+
"outputDir": "jupyterlite_terminal/labextension",
|
|
114
|
+
"sharedPackages": {
|
|
115
|
+
"@jupyterlite/contents": {
|
|
116
|
+
"bundled": false,
|
|
117
|
+
"singleton": true
|
|
118
|
+
},
|
|
119
|
+
"@jupyterlite/server": {
|
|
120
|
+
"bundled": false,
|
|
121
|
+
"singleton": true
|
|
122
|
+
}
|
|
123
|
+
}
|
|
114
124
|
},
|
|
115
125
|
"eslintIgnore": [
|
|
116
126
|
"node_modules",
|
package/src/client.ts
CHANGED
|
@@ -60,6 +60,9 @@ export class LiteTerminalAPIClient implements ILiteTerminalAPIClient {
|
|
|
60
60
|
'extensions/@jupyterlite/terminal/static/wasm/'
|
|
61
61
|
),
|
|
62
62
|
browsingContextId: this._browsingContextId,
|
|
63
|
+
aliases: this._aliases,
|
|
64
|
+
environment: this._environment,
|
|
65
|
+
externalCommands: this._externalCommands,
|
|
63
66
|
shellId: name,
|
|
64
67
|
shellManager: this._shellManager,
|
|
65
68
|
outputCallback: text => {
|
|
@@ -69,10 +72,6 @@ export class LiteTerminalAPIClient implements ILiteTerminalAPIClient {
|
|
|
69
72
|
});
|
|
70
73
|
this._shells.set(name, shell);
|
|
71
74
|
|
|
72
|
-
for (const externalCommand of this._externalCommands) {
|
|
73
|
-
shell.registerExternalCommand(externalCommand);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
75
|
// Hook to connect socket to shell.
|
|
77
76
|
const hook = async (
|
|
78
77
|
shell: Shell,
|
|
@@ -121,6 +120,20 @@ export class LiteTerminalAPIClient implements ILiteTerminalAPIClient {
|
|
|
121
120
|
return this._models;
|
|
122
121
|
}
|
|
123
122
|
|
|
123
|
+
registerAlias(key: string, value: string): void {
|
|
124
|
+
if (this._aliases === undefined) {
|
|
125
|
+
this._aliases = {};
|
|
126
|
+
}
|
|
127
|
+
this._aliases[key] = value;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
registerEnvironmentVariable(key: string, value: string | undefined): void {
|
|
131
|
+
if (this._environment === undefined) {
|
|
132
|
+
this._environment = {};
|
|
133
|
+
}
|
|
134
|
+
this._environment[key] = value;
|
|
135
|
+
}
|
|
136
|
+
|
|
124
137
|
registerExternalCommand(options: IExternalCommand.IOptions): void {
|
|
125
138
|
this._externalCommands.push(options);
|
|
126
139
|
}
|
|
@@ -150,6 +163,8 @@ export class LiteTerminalAPIClient implements ILiteTerminalAPIClient {
|
|
|
150
163
|
}
|
|
151
164
|
}
|
|
152
165
|
|
|
166
|
+
private _aliases?: { [key: string]: string };
|
|
167
|
+
private _environment?: { [key: string]: string | undefined };
|
|
153
168
|
private _browsingContextId?: string;
|
|
154
169
|
private _externalCommands: IExternalCommand.IOptions[] = [];
|
|
155
170
|
private _shellManager: IShellManager;
|
package/src/index.ts
CHANGED
package/src/tokens.ts
CHANGED
|
@@ -21,6 +21,19 @@ export interface ILiteTerminalAPIClient extends Terminal.ITerminalAPIClient {
|
|
|
21
21
|
*/
|
|
22
22
|
handleStdin(request: IStdinRequest): Promise<IStdinReply>;
|
|
23
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Register an alias that will be available in all terminals.
|
|
26
|
+
* If the key has already been registered, it will be overwritten.
|
|
27
|
+
*/
|
|
28
|
+
registerAlias(key: string, value: string): void;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Register an environment variable that will be available in all terminals.
|
|
32
|
+
* If the key has already been registered, it will be overwritten.
|
|
33
|
+
* A key with an undefined value will be deleted if already registered.
|
|
34
|
+
*/
|
|
35
|
+
registerEnvironmentVariable(key: string, value: string | undefined): void;
|
|
36
|
+
|
|
24
37
|
/**
|
|
25
38
|
* Register an external command that will be available in all terminals.
|
|
26
39
|
*/
|