@jupyterlite/xeus 0.1.0-a1
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/LICENSE +29 -0
- package/README.md +167 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.js +75 -0
- package/lib/web_worker_kernel.d.ts +80 -0
- package/lib/web_worker_kernel.js +169 -0
- package/lib/worker.d.ts +1 -0
- package/lib/worker.js +3 -0
- package/lib/worker.js.map +1 -0
- package/package.json +218 -0
- package/style/base.css +5 -0
- package/style/index.css +1 -0
- package/style/index.js +1 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023, JupyterLite Contributors
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
10
|
+
list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
+
this list of conditions and the following disclaimer in the documentation
|
|
14
|
+
and/or other materials provided with the distribution.
|
|
15
|
+
|
|
16
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
17
|
+
contributors may be used to endorse or promote products derived from
|
|
18
|
+
this software without specific prior written permission.
|
|
19
|
+
|
|
20
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
23
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
24
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
26
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
27
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
28
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/README.md
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
# jupyterlite_xeus
|
|
2
|
+
|
|
3
|
+
[](https://github.com/jupyterlite/xeus/actions/workflows/build.yml)
|
|
4
|
+
JupyterLite loader for Xeus kernels
|
|
5
|
+
|
|
6
|
+
## Requirements
|
|
7
|
+
|
|
8
|
+
- JupyterLab >= 4.0.0
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
To install the extension, execute:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pip install jupyterlite_xeus
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
### From environment.yaml
|
|
21
|
+
|
|
22
|
+
#### xeus-python kernel
|
|
23
|
+
|
|
24
|
+
To create a `xeus-python` kernel with a custom environment, one creates an `environment.yaml` file with `xeus-python` and the desiered dependencies. Here is an example with `numpy` as a additional dependency:
|
|
25
|
+
|
|
26
|
+
```yaml
|
|
27
|
+
name: xeus-lite-wasm
|
|
28
|
+
channels:
|
|
29
|
+
- https://repo.mamba.pm/emscripten-forge
|
|
30
|
+
- conda-forge
|
|
31
|
+
dependencies:
|
|
32
|
+
- xeus-python
|
|
33
|
+
- numpy
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
To build the jupyterlite run the following command, where `environment.yaml` is the path to the file you just created
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
jupyter lite build --XeusAddon.environment_file=some_path/to/environment.yaml
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
#### xeus-lua / xeus-sqlite / xeus-\<mylang\>
|
|
43
|
+
|
|
44
|
+
To create a `xeus-lua` or `xeus-sqlite` kernel you can
|
|
45
|
+
do the same as above, just with
|
|
46
|
+
|
|
47
|
+
```yaml
|
|
48
|
+
dependencies:
|
|
49
|
+
- xeus-lua
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
or
|
|
53
|
+
|
|
54
|
+
```yaml
|
|
55
|
+
dependencies:
|
|
56
|
+
- xeus-sqlite
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Note that xeus-sqlite and xeus-lua do not yet support additional dependencies.
|
|
60
|
+
To build the jupyterlite, run again:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
jupyter lite build --XeusAddon.environment_file=environment.yaml
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
#### Multiple kernels
|
|
67
|
+
|
|
68
|
+
To create a deployment with multiple kernels, you can just add them to the `environment.yaml` file:
|
|
69
|
+
|
|
70
|
+
```yaml
|
|
71
|
+
name: xeus-lite-wasm
|
|
72
|
+
channels:
|
|
73
|
+
- https://repo.mamba.pm/emscripten-forge
|
|
74
|
+
- conda-forge
|
|
75
|
+
dependencies:
|
|
76
|
+
- xeus-python
|
|
77
|
+
- xeus-lua
|
|
78
|
+
- xeus-sqlite
|
|
79
|
+
- numpy
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### From local environment / prefix
|
|
83
|
+
|
|
84
|
+
When developing a xeus-kernel, it is very usefull to be able to test it in a jupyterlite without having to publish it to emscripten-forge. Therefore you can also use a local environment / prefix to build a jupyterlite with a custom kernel.
|
|
85
|
+
|
|
86
|
+
#### Create a local environment / prefix
|
|
87
|
+
|
|
88
|
+
This workflow usually starts with creating a local conda environment / prefix for `emscripten-wasm32` with all the dependencies you need to build your kernel (here we install dependencies for `xeus-python` )
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
micromamba create -n xeus-python-dev \
|
|
92
|
+
--platform=emscripten-wasm32 \
|
|
93
|
+
-c https://repo.mamba.pm/emscripten-forge \
|
|
94
|
+
-c https://repo.mamba.pm/conda-forge \
|
|
95
|
+
--yes \
|
|
96
|
+
"python>=3.11" pybind11 nlohmann_json pybind11_json numpy pytest \
|
|
97
|
+
bzip2 sqlite zlib libffi xtl pyjs \
|
|
98
|
+
xeus xeus-sqlite
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
#### Build the kernel
|
|
102
|
+
|
|
103
|
+
This dependes on your kernel but will look smth like this:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
# path to your emscripten emsdk
|
|
107
|
+
source $EMSDK_DIR/emsdk_env.sh
|
|
108
|
+
|
|
109
|
+
WASM_ENV_NAME=xeus-python-dev
|
|
110
|
+
WASM_ENV_PREFIX=$MAMBA_ROOT_PREFIX/envs/$WASM_ENV_NAME
|
|
111
|
+
|
|
112
|
+
# let cmake know where the env is
|
|
113
|
+
export PREFIX=$WASM_ENV_PREFIX
|
|
114
|
+
export CMAKE_PREFIX_PATH=$PREFIX
|
|
115
|
+
export CMAKE_SYSTEM_PREFIX_PATH=$PREFIX
|
|
116
|
+
|
|
117
|
+
cd /path/to/your/kernel/src
|
|
118
|
+
mkdir build_wasm
|
|
119
|
+
cd build_wasm
|
|
120
|
+
emcmake cmake \
|
|
121
|
+
-DCMAKE_BUILD_TYPE=Release \
|
|
122
|
+
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON \
|
|
123
|
+
-DCMAKE_INSTALL_PREFIX=$PREFIX
|
|
124
|
+
..
|
|
125
|
+
emmake make -j8 install
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
When running `jupyter lite build` we pass the `prefix` options and point it to the local environment / prefix we just created:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
jupyter lite build --XeusAddon.prefix=$WASM_ENV_PREFIX
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Mounting additional files
|
|
135
|
+
|
|
136
|
+
To copy additional files and directories into the virtual filesytem of the xeus-lite kernels you can use the `--XeusAddon.mount` option.
|
|
137
|
+
Each mount is specified as a pair of paths separated by a colon `:`. The first path is the path to the file or directory on the host machine, the second path is the path to the file or directory in the virtual filesystem of the kernel.
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
jupyter lite build \
|
|
141
|
+
--XeusAddon.environment_file=environment.yaml \
|
|
142
|
+
--XeusAddon.mounts=/some/path/on/host_machine:/some/path/in/virtual/filesystem
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Contributing
|
|
146
|
+
|
|
147
|
+
### Development install from a conda / mamba environment
|
|
148
|
+
|
|
149
|
+
Create the conda environment with `conda`/`mamba`/`micromamba` (replace `micromamba` with `conda` or `mamba` according to your preference):
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
micromamba create -f environment-dev.yml -n xeus-lite-dev
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Activate the environment:
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
micromamba activate xeus-lite-dev
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
python -m pip install -e . -v --no-build-isolation
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Packaging the extension
|
|
166
|
+
|
|
167
|
+
See [RELEASE](RELEASE.md)
|
package/lib/index.d.ts
ADDED
package/lib/index.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// Copyright (c) Thorsten Beier
|
|
2
|
+
// Copyright (c) JupyterLite Contributors
|
|
3
|
+
// Distributed under the terms of the Modified BSD License.
|
|
4
|
+
import { IServiceWorkerManager } from '@jupyterlite/server';
|
|
5
|
+
import { IBroadcastChannelWrapper } from '@jupyterlite/contents';
|
|
6
|
+
import { IKernelSpecs } from '@jupyterlite/kernel';
|
|
7
|
+
import { WebWorkerKernel } from './web_worker_kernel';
|
|
8
|
+
const EXTENSION_NAME = 'xeus';
|
|
9
|
+
const EXTENSION_STATIC_DIR = `../extensions/@jupyterlite/${EXTENSION_NAME}/static/`;
|
|
10
|
+
// helper function to fetch json
|
|
11
|
+
function getPkgJson(url) {
|
|
12
|
+
const json_url = EXTENSION_STATIC_DIR + url;
|
|
13
|
+
const xhr = new XMLHttpRequest();
|
|
14
|
+
xhr.open('GET', json_url, false);
|
|
15
|
+
xhr.send(null);
|
|
16
|
+
return JSON.parse(xhr.responseText);
|
|
17
|
+
}
|
|
18
|
+
let kernel_dir = [];
|
|
19
|
+
try {
|
|
20
|
+
kernel_dir = getPkgJson('share/jupyter/kernels.json');
|
|
21
|
+
}
|
|
22
|
+
catch (err) {
|
|
23
|
+
console.log(err);
|
|
24
|
+
console.log('could not fetch share/jupyter/kernels/kernels.json');
|
|
25
|
+
kernel_dir = [];
|
|
26
|
+
throw err;
|
|
27
|
+
}
|
|
28
|
+
// fetch kernel spec for each kernel
|
|
29
|
+
const kernel_specs = kernel_dir.map(kernel_dir => {
|
|
30
|
+
const spec = getPkgJson('share/jupyter/kernels/' + kernel_dir + '/kernel.json');
|
|
31
|
+
spec.name = kernel_dir;
|
|
32
|
+
spec.dir = kernel_dir;
|
|
33
|
+
spec.resources = {
|
|
34
|
+
'logo-32x32': EXTENSION_STATIC_DIR +
|
|
35
|
+
'share/jupyter/kernels/' +
|
|
36
|
+
kernel_dir +
|
|
37
|
+
'/logo-32x32.png',
|
|
38
|
+
'logo-64x64': EXTENSION_STATIC_DIR +
|
|
39
|
+
'share/jupyter/kernels/' +
|
|
40
|
+
kernel_dir +
|
|
41
|
+
'/logo-64x64.png'
|
|
42
|
+
};
|
|
43
|
+
return spec;
|
|
44
|
+
});
|
|
45
|
+
const server_kernels = kernel_specs.map(kernelspec => {
|
|
46
|
+
const server_kernel = {
|
|
47
|
+
// use name from spec
|
|
48
|
+
id: `@jupyterlite/${kernelspec.name}-extension:kernel`,
|
|
49
|
+
autoStart: true,
|
|
50
|
+
requires: [IKernelSpecs],
|
|
51
|
+
optional: [IServiceWorkerManager, IBroadcastChannelWrapper],
|
|
52
|
+
activate: (app, kernelspecs, serviceWorker, broadcastChannel) => {
|
|
53
|
+
kernelspecs.register({
|
|
54
|
+
spec: kernelspec,
|
|
55
|
+
create: async (options) => {
|
|
56
|
+
const mountDrive = !!((serviceWorker === null || serviceWorker === void 0 ? void 0 : serviceWorker.enabled) && (broadcastChannel === null || broadcastChannel === void 0 ? void 0 : broadcastChannel.enabled));
|
|
57
|
+
if (mountDrive) {
|
|
58
|
+
console.info(`${kernelspec.name} contents will be synced with Jupyter Contents`);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
console.warn(`${kernelspec.name} contents will NOT be synced with Jupyter Contents`);
|
|
62
|
+
}
|
|
63
|
+
return new WebWorkerKernel({
|
|
64
|
+
...options,
|
|
65
|
+
mountDrive,
|
|
66
|
+
kernelspec
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
return server_kernel;
|
|
73
|
+
});
|
|
74
|
+
const plugins = server_kernels;
|
|
75
|
+
export default plugins;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { ISignal } from '@lumino/signaling';
|
|
2
|
+
import { KernelMessage } from '@jupyterlab/services';
|
|
3
|
+
import { IKernel } from '@jupyterlite/kernel';
|
|
4
|
+
export declare class WebWorkerKernel implements IKernel {
|
|
5
|
+
/**
|
|
6
|
+
* Instantiate a new WebWorkerKernel
|
|
7
|
+
*
|
|
8
|
+
* @param options The instantiation options for a new WebWorkerKernel
|
|
9
|
+
*/
|
|
10
|
+
constructor(options: WebWorkerKernel.IOptions);
|
|
11
|
+
handleMessage(msg: KernelMessage.IMessage): Promise<void>;
|
|
12
|
+
private _sendMessageToWorker;
|
|
13
|
+
/**
|
|
14
|
+
* Get the last parent header
|
|
15
|
+
*/
|
|
16
|
+
get parentHeader(): KernelMessage.IHeader<KernelMessage.MessageType> | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Get the last parent message (mimick ipykernel's get_parent)
|
|
19
|
+
*/
|
|
20
|
+
get parent(): KernelMessage.IMessage | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Get the kernel location
|
|
23
|
+
*/
|
|
24
|
+
get location(): string;
|
|
25
|
+
/**
|
|
26
|
+
* Process a message coming from the pyodide web worker.
|
|
27
|
+
*
|
|
28
|
+
* @param msg The worker message to process.
|
|
29
|
+
*/
|
|
30
|
+
private _processWorkerMessage;
|
|
31
|
+
/**
|
|
32
|
+
* A promise that is fulfilled when the kernel is ready.
|
|
33
|
+
*/
|
|
34
|
+
get ready(): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Return whether the kernel is disposed.
|
|
37
|
+
*/
|
|
38
|
+
get isDisposed(): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* A signal emitted when the kernel is disposed.
|
|
41
|
+
*/
|
|
42
|
+
get disposed(): ISignal<this, void>;
|
|
43
|
+
/**
|
|
44
|
+
* Dispose the kernel.
|
|
45
|
+
*/
|
|
46
|
+
dispose(): void;
|
|
47
|
+
/**
|
|
48
|
+
* Get the kernel id
|
|
49
|
+
*/
|
|
50
|
+
get id(): string;
|
|
51
|
+
/**
|
|
52
|
+
* Get the name of the kernel
|
|
53
|
+
*/
|
|
54
|
+
get name(): string;
|
|
55
|
+
private initFileSystem;
|
|
56
|
+
private _kernelspec;
|
|
57
|
+
private _id;
|
|
58
|
+
private _name;
|
|
59
|
+
private _location;
|
|
60
|
+
private _remote;
|
|
61
|
+
private _isDisposed;
|
|
62
|
+
private _disposed;
|
|
63
|
+
private _worker;
|
|
64
|
+
private _sendMessage;
|
|
65
|
+
private _executeDelegate;
|
|
66
|
+
private _parentHeader;
|
|
67
|
+
private _parent;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* A namespace for WebWorkerKernel statics.
|
|
71
|
+
*/
|
|
72
|
+
export declare namespace WebWorkerKernel {
|
|
73
|
+
/**
|
|
74
|
+
* The instantiation options for a Pyodide kernel
|
|
75
|
+
*/
|
|
76
|
+
interface IOptions extends IKernel.IOptions {
|
|
77
|
+
mountDrive: boolean;
|
|
78
|
+
kernelspec: any;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
// Copyright (c) Thorsten Beier
|
|
2
|
+
// Copyright (c) JupyterLite Contributors
|
|
3
|
+
// Distributed under the terms of the Modified BSD License.
|
|
4
|
+
import { wrap } from 'comlink';
|
|
5
|
+
import { Signal } from '@lumino/signaling';
|
|
6
|
+
import { PromiseDelegate } from '@lumino/coreutils';
|
|
7
|
+
import { PageConfig } from '@jupyterlab/coreutils';
|
|
8
|
+
export class WebWorkerKernel {
|
|
9
|
+
/**
|
|
10
|
+
* Instantiate a new WebWorkerKernel
|
|
11
|
+
*
|
|
12
|
+
* @param options The instantiation options for a new WebWorkerKernel
|
|
13
|
+
*/
|
|
14
|
+
constructor(options) {
|
|
15
|
+
this._isDisposed = false;
|
|
16
|
+
this._disposed = new Signal(this);
|
|
17
|
+
this._executeDelegate = new PromiseDelegate();
|
|
18
|
+
this._parentHeader = undefined;
|
|
19
|
+
this._parent = undefined;
|
|
20
|
+
console.log('constructing WebWorkerKernel kernel');
|
|
21
|
+
const { id, name, sendMessage, location } = options;
|
|
22
|
+
this._id = id;
|
|
23
|
+
this._name = name;
|
|
24
|
+
this._location = location;
|
|
25
|
+
this._kernelspec = options.kernelspec;
|
|
26
|
+
this._sendMessage = sendMessage;
|
|
27
|
+
console.log('constructing WebWorkerKernel worker');
|
|
28
|
+
this._worker = new Worker(new URL('./worker.js', import.meta.url), {
|
|
29
|
+
type: 'module'
|
|
30
|
+
});
|
|
31
|
+
console.log('constructing WebWorkerKernel done');
|
|
32
|
+
this._worker.onmessage = e => {
|
|
33
|
+
this._processWorkerMessage(e.data);
|
|
34
|
+
};
|
|
35
|
+
console.log('wrap');
|
|
36
|
+
this._remote = wrap(this._worker);
|
|
37
|
+
console.log('wrap done');
|
|
38
|
+
this._remote.processMessage({
|
|
39
|
+
msg: {
|
|
40
|
+
header: {
|
|
41
|
+
msg_type: '__initialize__'
|
|
42
|
+
},
|
|
43
|
+
kernelspec: this._kernelspec
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
console.log('init filesystem');
|
|
47
|
+
this.initFileSystem(options);
|
|
48
|
+
console.log('constructing WebWorkerKernel done2');
|
|
49
|
+
}
|
|
50
|
+
async handleMessage(msg) {
|
|
51
|
+
console.log('handleMessage', msg);
|
|
52
|
+
this._parent = msg;
|
|
53
|
+
this._parentHeader = msg.header;
|
|
54
|
+
console.log('send message to worker');
|
|
55
|
+
await this._sendMessageToWorker(msg);
|
|
56
|
+
console.log('send message to worker awaiting done');
|
|
57
|
+
}
|
|
58
|
+
async _sendMessageToWorker(msg) {
|
|
59
|
+
// TODO Remove this??
|
|
60
|
+
if (msg.header.msg_type !== 'input_reply') {
|
|
61
|
+
this._executeDelegate = new PromiseDelegate();
|
|
62
|
+
}
|
|
63
|
+
console.log(' this._remote.processMessage({ msg, parent: this.parent });');
|
|
64
|
+
await this._remote.processMessage({ msg, parent: this.parent });
|
|
65
|
+
console.log(' this._remote.processMessage({ msg, parent: this.parent }); done');
|
|
66
|
+
if (msg.header.msg_type !== 'input_reply') {
|
|
67
|
+
return await this._executeDelegate.promise;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Get the last parent header
|
|
72
|
+
*/
|
|
73
|
+
get parentHeader() {
|
|
74
|
+
return this._parentHeader;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Get the last parent message (mimick ipykernel's get_parent)
|
|
78
|
+
*/
|
|
79
|
+
get parent() {
|
|
80
|
+
return this._parent;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Get the kernel location
|
|
84
|
+
*/
|
|
85
|
+
get location() {
|
|
86
|
+
return this._location;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Process a message coming from the pyodide web worker.
|
|
90
|
+
*
|
|
91
|
+
* @param msg The worker message to process.
|
|
92
|
+
*/
|
|
93
|
+
_processWorkerMessage(msg) {
|
|
94
|
+
var _a, _b, _c, _d;
|
|
95
|
+
console.log('processWorkerMessage', msg);
|
|
96
|
+
if (!msg.header) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
msg.header.session = (_b = (_a = this._parentHeader) === null || _a === void 0 ? void 0 : _a.session) !== null && _b !== void 0 ? _b : '';
|
|
100
|
+
msg.session = (_d = (_c = this._parentHeader) === null || _c === void 0 ? void 0 : _c.session) !== null && _d !== void 0 ? _d : '';
|
|
101
|
+
this._sendMessage(msg);
|
|
102
|
+
// resolve promise
|
|
103
|
+
if (msg.header.msg_type === 'status' &&
|
|
104
|
+
msg.content.execution_state === 'idle') {
|
|
105
|
+
this._executeDelegate.resolve();
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* A promise that is fulfilled when the kernel is ready.
|
|
110
|
+
*/
|
|
111
|
+
get ready() {
|
|
112
|
+
return Promise.resolve();
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Return whether the kernel is disposed.
|
|
116
|
+
*/
|
|
117
|
+
get isDisposed() {
|
|
118
|
+
return this._isDisposed;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* A signal emitted when the kernel is disposed.
|
|
122
|
+
*/
|
|
123
|
+
get disposed() {
|
|
124
|
+
return this._disposed;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Dispose the kernel.
|
|
128
|
+
*/
|
|
129
|
+
dispose() {
|
|
130
|
+
if (this.isDisposed) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
this._worker.terminate();
|
|
134
|
+
this._worker = null;
|
|
135
|
+
this._remote = null;
|
|
136
|
+
this._isDisposed = true;
|
|
137
|
+
this._disposed.emit(void 0);
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Get the kernel id
|
|
141
|
+
*/
|
|
142
|
+
get id() {
|
|
143
|
+
return this._id;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Get the name of the kernel
|
|
147
|
+
*/
|
|
148
|
+
get name() {
|
|
149
|
+
return this._name;
|
|
150
|
+
}
|
|
151
|
+
async initFileSystem(options) {
|
|
152
|
+
let driveName;
|
|
153
|
+
let localPath;
|
|
154
|
+
if (options.location.includes(':')) {
|
|
155
|
+
const parts = options.location.split(':');
|
|
156
|
+
driveName = parts[0];
|
|
157
|
+
localPath = parts[1];
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
driveName = '';
|
|
161
|
+
localPath = options.location;
|
|
162
|
+
}
|
|
163
|
+
await this._remote.ready();
|
|
164
|
+
if (options.mountDrive) {
|
|
165
|
+
await this._remote.mount(driveName, '/drive', PageConfig.getBaseUrl());
|
|
166
|
+
await this._remote.cd(localPath);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
package/lib/worker.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/worker.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/*! For license information please see worker.js.LICENSE.txt */
|
|
2
|
+
define((()=>(()=>{"use strict";var e={};(e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})})(e);const t=Symbol("Comlink.proxy"),r=Symbol("Comlink.endpoint"),s=Symbol("Comlink.releaseProxy"),n=Symbol("Comlink.finalizer"),i=Symbol("Comlink.thrown"),o=e=>"object"==typeof e&&null!==e||"function"==typeof e,a=new Map([["proxy",{canHandle:e=>o(e)&&e[t],serialize(e){const{port1:t,port2:r}=new MessageChannel;return l(e,t),[r,[r]]},deserialize:e=>(e.start(),p(e,[],undefined))}],["throw",{canHandle:e=>o(e)&&i in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){if(e.isError)throw Object.assign(new Error(e.value.message),e.value);throw e.value}}]]);function l(e,r=globalThis,s=["*"]){r.addEventListener("message",(function o(a){if(!a||!a.data)return;if(!function(e,t){for(const r of e){if(t===r||"*"===r)return!0;if(r instanceof RegExp&&r.test(t))return!0}return!1}(s,a.origin))return void console.warn(`Invalid origin '${a.origin}' for comlink proxy`);const{id:u,type:d,path:c}=Object.assign({path:[]},a.data),m=(a.data.argumentList||[]).map(w);let p;try{const r=c.slice(0,-1).reduce(((e,t)=>e[t]),e),s=c.reduce(((e,t)=>e[t]),e);switch(d){case"GET":p=s;break;case"SET":r[c.slice(-1)[0]]=w(a.data.value),p=!0;break;case"APPLY":p=s.apply(r,m);break;case"CONSTRUCT":p=function(e){return Object.assign(e,{[t]:!0})}(new s(...m));break;case"ENDPOINT":{const{port1:t,port2:r}=new MessageChannel;l(e,r),p=function(e,t){return g.set(e,t),e}(t,[t])}break;case"RELEASE":p=void 0;break;default:return}}catch(e){p={value:e,[i]:0}}Promise.resolve(p).catch((e=>({value:e,[i]:0}))).then((t=>{const[s,i]=E(t);r.postMessage(Object.assign(Object.assign({},s),{id:u}),i),"RELEASE"===d&&(r.removeEventListener("message",o),h(r),n in e&&"function"==typeof e[n]&&e[n]())})).catch((e=>{const[t,s]=E({value:new TypeError("Unserializable return value"),[i]:0});r.postMessage(Object.assign(Object.assign({},t),{id:u}),s)}))})),r.start&&r.start()}function h(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function u(e){if(e)throw new Error("Proxy has been released and is not useable")}function d(e){return y(e,{type:"RELEASE"}).then((()=>{h(e)}))}const c=new WeakMap,m="FinalizationRegistry"in globalThis&&new FinalizationRegistry((e=>{const t=(c.get(e)||0)-1;c.set(e,t),0===t&&d(e)}));function p(e,t=[],n=function(){}){let i=!1;const o=new Proxy(n,{get(r,n){if(u(i),n===s)return()=>{!function(e){m&&m.unregister(e)}(o),d(e),i=!0};if("then"===n){if(0===t.length)return{then:()=>o};const r=y(e,{type:"GET",path:t.map((e=>e.toString()))}).then(w);return r.then.bind(r)}return p(e,[...t,n])},set(r,s,n){u(i);const[o,a]=E(n);return y(e,{type:"SET",path:[...t,s].map((e=>e.toString())),value:o},a).then(w)},apply(s,n,o){u(i);const a=t[t.length-1];if(a===r)return y(e,{type:"ENDPOINT"}).then(w);if("bind"===a)return p(e,t.slice(0,-1));const[l,h]=f(o);return y(e,{type:"APPLY",path:t.map((e=>e.toString())),argumentList:l},h).then(w)},construct(r,s){u(i);const[n,o]=f(s);return y(e,{type:"CONSTRUCT",path:t.map((e=>e.toString())),argumentList:n},o).then(w)}});return function(e,t){const r=(c.get(t)||0)+1;c.set(t,r),m&&m.register(e,t,e)}(o,e),o}function f(e){const t=e.map(E);return[t.map((e=>e[0])),(r=t.map((e=>e[1])),Array.prototype.concat.apply([],r))];var r}const g=new WeakMap;function E(e){for(const[t,r]of a)if(r.canHandle(e)){const[s,n]=r.serialize(e);return[{type:"HANDLER",name:t,value:s},n]}return[{type:"RAW",value:e},g.get(e)||[]]}function w(e){switch(e.type){case"HANDLER":return a.get(e.name).deserialize(e.value);case"RAW":return e.value}}function y(e,t,r){return new Promise((s=>{const n=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");e.addEventListener("message",(function t(r){r.data&&r.data.id&&r.data.id===n&&(e.removeEventListener("message",t),s(r.data))})),e.start&&e.start(),e.postMessage(Object.assign({id:n},t),r)}))}const _=new TextEncoder,b=new TextDecoder("utf-8"),v={0:!1,1:!0,2:!0,64:!0,65:!0,66:!0,129:!0,193:!0,514:!0,577:!0,578:!0,705:!0,706:!0,1024:!0,1025:!0,1026:!0,1089:!0,1090:!0,1153:!0,1154:!0,1217:!0,1218:!0,4096:!0,4098:!0};class P{constructor(e){this.fs=e}open(e){const t=this.fs.realPath(e.node);this.fs.FS.isFile(e.node.mode)&&(e.file=this.fs.API.get(t))}close(e){if(!this.fs.FS.isFile(e.node.mode)||!e.file)return;const t=this.fs.realPath(e.node),r=e.flags;let s="string"==typeof r?parseInt(r,10):r;s&=8191;let n=!0;s in v&&(n=v[s]),n&&this.fs.API.put(t,e.file),e.file=void 0}read(e,t,r,s,n){if(s<=0||void 0===e.file||n>=(e.file.data.length||0))return 0;const i=Math.min(e.file.data.length-n,s);return t.set(e.file.data.subarray(n,n+i),r),i}write(e,t,r,s,n){var i;if(s<=0||void 0===e.file)return 0;if(e.node.timestamp=Date.now(),n+s>((null===(i=e.file)||void 0===i?void 0:i.data.length)||0)){const t=e.file.data?e.file.data:new Uint8Array;e.file.data=new Uint8Array(n+s),e.file.data.set(t)}return e.file.data.set(t.subarray(r,r+s),n),s}llseek(e,t,r){let s=t;if(1===r)s+=e.position;else if(2===r&&this.fs.FS.isFile(e.node.mode)){if(void 0===e.file)throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.EPERM);s+=e.file.data.length}if(s<0)throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.EINVAL);return s}}class S{constructor(e){this.fs=e}getattr(e){return{...this.fs.API.getattr(this.fs.realPath(e)),mode:e.mode,ino:e.id}}setattr(e,t){for(const[r,s]of Object.entries(t))switch(r){case"mode":e.mode=s;break;case"timestamp":e.timestamp=s;break;default:console.warn("setattr",r,"of",s,"on",e,"not yet implemented")}}lookup(e,t){const r=this.fs.PATH.join2(this.fs.realPath(e),t),s=this.fs.API.lookup(r);if(!s.ok)throw this.fs.FS.genericErrors[this.fs.ERRNO_CODES.ENOENT];return this.fs.createNode(e,t,s.mode,0)}mknod(e,t,r,s){const n=this.fs.PATH.join2(this.fs.realPath(e),t);return this.fs.API.mknod(n,r),this.fs.createNode(e,t,r,s)}rename(e,t,r){this.fs.API.rename(e.parent?this.fs.PATH.join2(this.fs.realPath(e.parent),e.name):e.name,this.fs.PATH.join2(this.fs.realPath(t),r)),e.name=r,e.parent=t}unlink(e,t){this.fs.API.rmdir(this.fs.PATH.join2(this.fs.realPath(e),t))}rmdir(e,t){this.fs.API.rmdir(this.fs.PATH.join2(this.fs.realPath(e),t))}readdir(e){return this.fs.API.readdir(this.fs.realPath(e))}symlink(e,t,r){throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.EPERM)}readlink(e){throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.EPERM)}}class T{constructor(e,t,r,s,n){this._baseUrl=e,this._driveName=t,this._mountpoint=r,this.FS=s,this.ERRNO_CODES=n}request(e){const t=new XMLHttpRequest;t.open("POST",encodeURI(this.endpoint),!1);try{t.send(JSON.stringify(e))}catch(e){console.error(e)}if(t.status>=400)throw new this.FS.ErrnoError(this.ERRNO_CODES.EINVAL);return JSON.parse(t.responseText)}lookup(e){return this.request({method:"lookup",path:this.normalizePath(e)})}getmode(e){return Number.parseInt(this.request({method:"getmode",path:this.normalizePath(e)}))}mknod(e,t){return this.request({method:"mknod",path:this.normalizePath(e),data:{mode:t}})}rename(e,t){return this.request({method:"rename",path:this.normalizePath(e),data:{newPath:this.normalizePath(t)}})}readdir(e){const t=this.request({method:"readdir",path:this.normalizePath(e)});return t.push("."),t.push(".."),t}rmdir(e){return this.request({method:"rmdir",path:this.normalizePath(e)})}get(e){const t=this.request({method:"get",path:this.normalizePath(e)}),r=t.content,s=t.format;switch(s){case"json":case"text":return{data:_.encode(r),format:s};case"base64":{const e=atob(r),t=e.length,n=new Uint8Array(t);for(let r=0;r<t;r++)n[r]=e.charCodeAt(r);return{data:n,format:s}}default:throw new this.FS.ErrnoError(this.ERRNO_CODES.ENOENT)}}put(e,t){switch(t.format){case"json":case"text":return this.request({method:"put",path:this.normalizePath(e),data:{format:t.format,data:b.decode(t.data)}});case"base64":{let r="";for(let e=0;e<t.data.byteLength;e++)r+=String.fromCharCode(t.data[e]);return this.request({method:"put",path:this.normalizePath(e),data:{format:t.format,data:btoa(r)}})}}}getattr(e){const t=this.request({method:"getattr",path:this.normalizePath(e)});return t.atime=new Date(t.atime),t.mtime=new Date(t.mtime),t.ctime=new Date(t.ctime),t.size=t.size||0,t}normalizePath(e){return e.startsWith(this._mountpoint)&&(e=e.slice(this._mountpoint.length)),this._driveName&&(e=`${this._driveName}:${e}`),e}get endpoint(){return`${this._baseUrl}api/drive`}}class N{constructor(e){this.FS=e.FS,this.PATH=e.PATH,this.ERRNO_CODES=e.ERRNO_CODES,this.API=new T(e.baseUrl,e.driveName,e.mountpoint,this.FS,this.ERRNO_CODES),this.driveName=e.driveName,this.node_ops=new S(this),this.stream_ops=new P(this)}mount(e){return this.createNode(null,e.mountpoint,16895,0)}createNode(e,t,r,s){const n=this.FS;if(!n.isDir(r)&&!n.isFile(r))throw new n.ErrnoError(this.ERRNO_CODES.EINVAL);const i=n.createNode(e,t,r,s);return i.node_ops=this.node_ops,i.stream_ops=this.stream_ops,i}getMode(e){return this.API.getmode(e)}realPath(e){const t=[];let r=e;for(t.push(r.name);r.parent!==r;)r=r.parent,t.push(r.name);return t.reverse(),this.PATH.join.apply(null,t)}}console.log("worker loaded"),globalThis.Module={};class R extends S{getNode(e){return e.node?e.node:e}lookup(e,t){return super.lookup(this.getNode(e),t)}getattr(e){return super.getattr(this.getNode(e))}setattr(e,t){super.setattr(this.getNode(e),t)}mknod(e,t,r,s){return super.mknod(this.getNode(e),t,r,s)}rename(e,t,r){super.rename(this.getNode(e),this.getNode(t),r)}rmdir(e,t){super.rmdir(this.getNode(e),t)}readdir(e){return super.readdir(this.getNode(e))}}class k extends N{constructor(e){super(e),this.node_ops=new R(this)}}let O;globalThis.toplevel_promise=null,globalThis.toplevel_promise_py_proxy=null,self.get_stdin=async function(){return new Promise((e=>{O=e}))};class A{constructor(e){this._drive=null,console.log("constructing kernel"),this._resolve=e}async ready(){return await globalThis.ready}mount(e,t,r){console.log("mounting drive");const{FS:s,PATH:n,ERRNO_CODES:i}=globalThis.Module;s&&(this._drive=new k({FS:s,PATH:n,ERRNO_CODES:i,baseUrl:r,driveName:e,mountpoint:t}),s.mkdir(t),s.mount(this._drive,{},t),s.chdir(t))}cd(e){e&&globalThis.Module.FS&&globalThis.Module.FS.chdir(e)}async processMessage(e){const t=e.msg.header.msg_type;if("__initialize__"===t)return this._kernelspec=e.msg.kernelspec,void await this.initialize();await this.ready(),null!==globalThis.toplevel_promise&&null!==globalThis.toplevel_promise_py_proxy&&(await globalThis.toplevel_promise,globalThis.toplevel_promise_py_proxy.delete(),globalThis.toplevel_promise_py_proxy=null,globalThis.toplevel_promise=null),"input_reply"===t?O(e.msg):this._raw_xserver.notify_listener(e.msg)}async initialize(){const e=this._kernelspec.dir,t=this._kernelspec.argv[0],r=t.replace(".js",".wasm");importScripts(t),globalThis.Module=await createXeusModule({locateFile:e=>e.endsWith(".wasm")?r:e});try{if(await this.waitRunDependency(),console.log(globalThis.Module),void 0!==globalThis.Module.async_init){const t=`share/jupyter/kernels/${e}`,r="share/jupyter/kernel_packages",s=!0;await globalThis.Module.async_init(t,r,s)}await this.waitRunDependency(),this._raw_xkernel=new globalThis.Module.xkernel,this._raw_xserver=this._raw_xkernel.get_server(),this._raw_xkernel||console.error("Failed to start kernel!"),this._raw_xkernel.start()}catch(e){if("number"==typeof e){const t=globalThis.Module.get_exception_message(e);throw console.error(t),new Error(t)}throw console.error(e),e}this._resolve()}async waitRunDependency(){const e=new Promise((e=>{globalThis.Module.monitorRunDependencies=t=>{0===t&&e()}}));return globalThis.Module.addRunDependency("dummy"),globalThis.Module.removeRunDependency("dummy"),e}}return globalThis.ready=new Promise((e=>{console.log("expose(new XeusKernel(resolve));"),l(new A(e))})),e})()));
|
|
3
|
+
//# sourceMappingURL=worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker.js","mappings":";+BACA,SCAwB,CAACA,IACH,o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a9Q,OACtB,CACA,MAAOyL,GACH,GAAiB,iBAANA,EAAgB,CACvB,MAAM3F,EAAMnF,WAAWyN,OAAO6C,sBAAsBxF,GAEpD,MADAnK,QAAQ+B,MAAMyC,GACR,IAAI1F,MAAM0F,EACpB,CAGI,MADAxE,QAAQ+B,MAAMoI,GACRA,CAEd,CACA3E,KAAKoI,UACT,CACA,uBAAMwB,GACF,MAAMQ,EAAU,IAAIvO,SAAQC,IACxBjC,WAAWyN,OAAO+C,uBAA0BC,IAC9B,IAANA,GACAxO,GACJ,CACH,IAOL,OAFAjC,WAAWyN,OAAOiD,iBAAiB,SACnC1Q,WAAWyN,OAAOkD,oBAAoB,SAC/BJ,CACX,SAEJvQ,WAAWwO,MAAQ,IAAIxM,SAAQC,IAC3BtB,QAAQ6M,IAAI,oCACZtO,EAAO,IAAImP,EAAWpM,GAAS","sources":["webpack://@jupyterlite/xeus/webpack/bootstrap","webpack://@jupyterlite/xeus/webpack/runtime/make namespace object","webpack://@jupyterlite/xeus/./node_modules/comlink/dist/esm/comlink.mjs","webpack://@jupyterlite/xeus/./node_modules/@jupyterlite/contents/lib/emscripten.js","webpack://@jupyterlite/xeus/./node_modules/@jupyterlite/contents/lib/drivefs.js","webpack://@jupyterlite/xeus/./lib/worker.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/**\n * @license\n * Copyright 2019 Google LLC\n * SPDX-License-Identifier: Apache-2.0\n */\nconst proxyMarker = Symbol(\"Comlink.proxy\");\nconst createEndpoint = Symbol(\"Comlink.endpoint\");\nconst releaseProxy = Symbol(\"Comlink.releaseProxy\");\nconst finalizer = Symbol(\"Comlink.finalizer\");\nconst throwMarker = Symbol(\"Comlink.thrown\");\nconst isObject = (val) => (typeof val === \"object\" && val !== null) || typeof val === \"function\";\n/**\n * Internal transfer handle to handle objects marked to proxy.\n */\nconst proxyTransferHandler = {\n canHandle: (val) => isObject(val) && val[proxyMarker],\n serialize(obj) {\n const { port1, port2 } = new MessageChannel();\n expose(obj, port1);\n return [port2, [port2]];\n },\n deserialize(port) {\n port.start();\n return wrap(port);\n },\n};\n/**\n * Internal transfer handler to handle thrown exceptions.\n */\nconst throwTransferHandler = {\n canHandle: (value) => isObject(value) && throwMarker in value,\n serialize({ value }) {\n let serialized;\n if (value instanceof Error) {\n serialized = {\n isError: true,\n value: {\n message: value.message,\n name: value.name,\n stack: value.stack,\n },\n };\n }\n else {\n serialized = { isError: false, value };\n }\n return [serialized, []];\n },\n deserialize(serialized) {\n if (serialized.isError) {\n throw Object.assign(new Error(serialized.value.message), serialized.value);\n }\n throw serialized.value;\n },\n};\n/**\n * Allows customizing the serialization of certain values.\n */\nconst transferHandlers = new Map([\n [\"proxy\", proxyTransferHandler],\n [\"throw\", throwTransferHandler],\n]);\nfunction isAllowedOrigin(allowedOrigins, origin) {\n for (const allowedOrigin of allowedOrigins) {\n if (origin === allowedOrigin || allowedOrigin === \"*\") {\n return true;\n }\n if (allowedOrigin instanceof RegExp && allowedOrigin.test(origin)) {\n return true;\n }\n }\n return false;\n}\nfunction expose(obj, ep = globalThis, allowedOrigins = [\"*\"]) {\n ep.addEventListener(\"message\", function callback(ev) {\n if (!ev || !ev.data) {\n return;\n }\n if (!isAllowedOrigin(allowedOrigins, ev.origin)) {\n console.warn(`Invalid origin '${ev.origin}' for comlink proxy`);\n return;\n }\n const { id, type, path } = Object.assign({ path: [] }, ev.data);\n const argumentList = (ev.data.argumentList || []).map(fromWireValue);\n let returnValue;\n try {\n const parent = path.slice(0, -1).reduce((obj, prop) => obj[prop], obj);\n const rawValue = path.reduce((obj, prop) => obj[prop], obj);\n switch (type) {\n case \"GET\" /* MessageType.GET */:\n {\n returnValue = rawValue;\n }\n break;\n case \"SET\" /* MessageType.SET */:\n {\n parent[path.slice(-1)[0]] = fromWireValue(ev.data.value);\n returnValue = true;\n }\n break;\n case \"APPLY\" /* MessageType.APPLY */:\n {\n returnValue = rawValue.apply(parent, argumentList);\n }\n break;\n case \"CONSTRUCT\" /* MessageType.CONSTRUCT */:\n {\n const value = new rawValue(...argumentList);\n returnValue = proxy(value);\n }\n break;\n case \"ENDPOINT\" /* MessageType.ENDPOINT */:\n {\n const { port1, port2 } = new MessageChannel();\n expose(obj, port2);\n returnValue = transfer(port1, [port1]);\n }\n break;\n case \"RELEASE\" /* MessageType.RELEASE */:\n {\n returnValue = undefined;\n }\n break;\n default:\n return;\n }\n }\n catch (value) {\n returnValue = { value, [throwMarker]: 0 };\n }\n Promise.resolve(returnValue)\n .catch((value) => {\n return { value, [throwMarker]: 0 };\n })\n .then((returnValue) => {\n const [wireValue, transferables] = toWireValue(returnValue);\n ep.postMessage(Object.assign(Object.assign({}, wireValue), { id }), transferables);\n if (type === \"RELEASE\" /* MessageType.RELEASE */) {\n // detach and deactive after sending release response above.\n ep.removeEventListener(\"message\", callback);\n closeEndPoint(ep);\n if (finalizer in obj && typeof obj[finalizer] === \"function\") {\n obj[finalizer]();\n }\n }\n })\n .catch((error) => {\n // Send Serialization Error To Caller\n const [wireValue, transferables] = toWireValue({\n value: new TypeError(\"Unserializable return value\"),\n [throwMarker]: 0,\n });\n ep.postMessage(Object.assign(Object.assign({}, wireValue), { id }), transferables);\n });\n });\n if (ep.start) {\n ep.start();\n }\n}\nfunction isMessagePort(endpoint) {\n return endpoint.constructor.name === \"MessagePort\";\n}\nfunction closeEndPoint(endpoint) {\n if (isMessagePort(endpoint))\n endpoint.close();\n}\nfunction wrap(ep, target) {\n return createProxy(ep, [], target);\n}\nfunction throwIfProxyReleased(isReleased) {\n if (isReleased) {\n throw new Error(\"Proxy has been released and is not useable\");\n }\n}\nfunction releaseEndpoint(ep) {\n return requestResponseMessage(ep, {\n type: \"RELEASE\" /* MessageType.RELEASE */,\n }).then(() => {\n closeEndPoint(ep);\n });\n}\nconst proxyCounter = new WeakMap();\nconst proxyFinalizers = \"FinalizationRegistry\" in globalThis &&\n new FinalizationRegistry((ep) => {\n const newCount = (proxyCounter.get(ep) || 0) - 1;\n proxyCounter.set(ep, newCount);\n if (newCount === 0) {\n releaseEndpoint(ep);\n }\n });\nfunction registerProxy(proxy, ep) {\n const newCount = (proxyCounter.get(ep) || 0) + 1;\n proxyCounter.set(ep, newCount);\n if (proxyFinalizers) {\n proxyFinalizers.register(proxy, ep, proxy);\n }\n}\nfunction unregisterProxy(proxy) {\n if (proxyFinalizers) {\n proxyFinalizers.unregister(proxy);\n }\n}\nfunction createProxy(ep, path = [], target = function () { }) {\n let isProxyReleased = false;\n const proxy = new Proxy(target, {\n get(_target, prop) {\n throwIfProxyReleased(isProxyReleased);\n if (prop === releaseProxy) {\n return () => {\n unregisterProxy(proxy);\n releaseEndpoint(ep);\n isProxyReleased = true;\n };\n }\n if (prop === \"then\") {\n if (path.length === 0) {\n return { then: () => proxy };\n }\n const r = requestResponseMessage(ep, {\n type: \"GET\" /* MessageType.GET */,\n path: path.map((p) => p.toString()),\n }).then(fromWireValue);\n return r.then.bind(r);\n }\n return createProxy(ep, [...path, prop]);\n },\n set(_target, prop, rawValue) {\n throwIfProxyReleased(isProxyReleased);\n // FIXME: ES6 Proxy Handler `set` methods are supposed to return a\n // boolean. To show good will, we return true asynchronously ¯\\_(ツ)_/¯\n const [value, transferables] = toWireValue(rawValue);\n return requestResponseMessage(ep, {\n type: \"SET\" /* MessageType.SET */,\n path: [...path, prop].map((p) => p.toString()),\n value,\n }, transferables).then(fromWireValue);\n },\n apply(_target, _thisArg, rawArgumentList) {\n throwIfProxyReleased(isProxyReleased);\n const last = path[path.length - 1];\n if (last === createEndpoint) {\n return requestResponseMessage(ep, {\n type: \"ENDPOINT\" /* MessageType.ENDPOINT */,\n }).then(fromWireValue);\n }\n // We just pretend that `bind()` didn’t happen.\n if (last === \"bind\") {\n return createProxy(ep, path.slice(0, -1));\n }\n const [argumentList, transferables] = processArguments(rawArgumentList);\n return requestResponseMessage(ep, {\n type: \"APPLY\" /* MessageType.APPLY */,\n path: path.map((p) => p.toString()),\n argumentList,\n }, transferables).then(fromWireValue);\n },\n construct(_target, rawArgumentList) {\n throwIfProxyReleased(isProxyReleased);\n const [argumentList, transferables] = processArguments(rawArgumentList);\n return requestResponseMessage(ep, {\n type: \"CONSTRUCT\" /* MessageType.CONSTRUCT */,\n path: path.map((p) => p.toString()),\n argumentList,\n }, transferables).then(fromWireValue);\n },\n });\n registerProxy(proxy, ep);\n return proxy;\n}\nfunction myFlat(arr) {\n return Array.prototype.concat.apply([], arr);\n}\nfunction processArguments(argumentList) {\n const processed = argumentList.map(toWireValue);\n return [processed.map((v) => v[0]), myFlat(processed.map((v) => v[1]))];\n}\nconst transferCache = new WeakMap();\nfunction transfer(obj, transfers) {\n transferCache.set(obj, transfers);\n return obj;\n}\nfunction proxy(obj) {\n return Object.assign(obj, { [proxyMarker]: true });\n}\nfunction windowEndpoint(w, context = globalThis, targetOrigin = \"*\") {\n return {\n postMessage: (msg, transferables) => w.postMessage(msg, targetOrigin, transferables),\n addEventListener: context.addEventListener.bind(context),\n removeEventListener: context.removeEventListener.bind(context),\n };\n}\nfunction toWireValue(value) {\n for (const [name, handler] of transferHandlers) {\n if (handler.canHandle(value)) {\n const [serializedValue, transferables] = handler.serialize(value);\n return [\n {\n type: \"HANDLER\" /* WireValueType.HANDLER */,\n name,\n value: serializedValue,\n },\n transferables,\n ];\n }\n }\n return [\n {\n type: \"RAW\" /* WireValueType.RAW */,\n value,\n },\n transferCache.get(value) || [],\n ];\n}\nfunction fromWireValue(value) {\n switch (value.type) {\n case \"HANDLER\" /* WireValueType.HANDLER */:\n return transferHandlers.get(value.name).deserialize(value.value);\n case \"RAW\" /* WireValueType.RAW */:\n return value.value;\n }\n}\nfunction requestResponseMessage(ep, msg, transfers) {\n return new Promise((resolve) => {\n const id = generateUUID();\n ep.addEventListener(\"message\", function l(ev) {\n if (!ev.data || !ev.data.id || ev.data.id !== id) {\n return;\n }\n ep.removeEventListener(\"message\", l);\n resolve(ev.data);\n });\n if (ep.start) {\n ep.start();\n }\n ep.postMessage(Object.assign({ id }, msg), transfers);\n });\n}\nfunction generateUUID() {\n return new Array(4)\n .fill(0)\n .map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16))\n .join(\"-\");\n}\n\nexport { createEndpoint, expose, finalizer, proxy, proxyMarker, releaseProxy, transfer, transferHandlers, windowEndpoint, wrap };\n//# sourceMappingURL=comlink.mjs.map\n","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n/// <reference path=\"../../../node_modules/@types/emscripten/index.d.ts\" />\nexport const DIR_MODE = 16895; // 040777\nexport const FILE_MODE = 33206; // 100666\nexport const SEEK_CUR = 1;\nexport const SEEK_END = 2;\n//# sourceMappingURL=emscripten.js.map","// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n// Types and implementation inspired from https://github.com/jvilk/BrowserFS\n// LICENSE: https://github.com/jvilk/BrowserFS/blob/8977a704ea469d05daf857e4818bef1f4f498326/LICENSE\n// And from https://github.com/gzuidhof/starboard-notebook\n// LICENSE: https://github.com/gzuidhof/starboard-notebook/blob/cd8d3fc30af4bd29cdd8f6b8c207df8138f5d5dd/LICENSE\nimport { DIR_MODE, SEEK_CUR, SEEK_END, } from './emscripten';\nexport const DRIVE_SEPARATOR = ':';\nexport const DRIVE_API_PATH = '/api/drive.v1';\nexport const BLOCK_SIZE = 4096;\nconst encoder = new TextEncoder();\nconst decoder = new TextDecoder('utf-8');\n// Mapping flag -> do we need to overwrite the file upon closing it\nconst flagNeedsWrite = {\n 0 /*O_RDONLY*/: false,\n 1 /*O_WRONLY*/: true,\n 2 /*O_RDWR*/: true,\n 64 /*O_CREAT*/: true,\n 65 /*O_WRONLY|O_CREAT*/: true,\n 66 /*O_RDWR|O_CREAT*/: true,\n 129 /*O_WRONLY|O_EXCL*/: true,\n 193 /*O_WRONLY|O_CREAT|O_EXCL*/: true,\n 514 /*O_RDWR|O_TRUNC*/: true,\n 577 /*O_WRONLY|O_CREAT|O_TRUNC*/: true,\n 578 /*O_CREAT|O_RDWR|O_TRUNC*/: true,\n 705 /*O_WRONLY|O_CREAT|O_EXCL|O_TRUNC*/: true,\n 706 /*O_RDWR|O_CREAT|O_EXCL|O_TRUNC*/: true,\n 1024 /*O_APPEND*/: true,\n 1025 /*O_WRONLY|O_APPEND*/: true,\n 1026 /*O_RDWR|O_APPEND*/: true,\n 1089 /*O_WRONLY|O_CREAT|O_APPEND*/: true,\n 1090 /*O_RDWR|O_CREAT|O_APPEND*/: true,\n 1153 /*O_WRONLY|O_EXCL|O_APPEND*/: true,\n 1154 /*O_RDWR|O_EXCL|O_APPEND*/: true,\n 1217 /*O_WRONLY|O_CREAT|O_EXCL|O_APPEND*/: true,\n 1218 /*O_RDWR|O_CREAT|O_EXCL|O_APPEND*/: true,\n 4096 /*O_RDONLY|O_DSYNC*/: true,\n 4098 /*O_RDWR|O_DSYNC*/: true,\n};\nexport class DriveFSEmscriptenStreamOps {\n constructor(fs) {\n this.fs = fs;\n }\n open(stream) {\n const path = this.fs.realPath(stream.node);\n if (this.fs.FS.isFile(stream.node.mode)) {\n stream.file = this.fs.API.get(path);\n }\n }\n close(stream) {\n if (!this.fs.FS.isFile(stream.node.mode) || !stream.file) {\n return;\n }\n const path = this.fs.realPath(stream.node);\n const flags = stream.flags;\n let parsedFlags = typeof flags === 'string' ? parseInt(flags, 10) : flags;\n parsedFlags &= 0x1fff;\n let needsWrite = true;\n if (parsedFlags in flagNeedsWrite) {\n needsWrite = flagNeedsWrite[parsedFlags];\n }\n if (needsWrite) {\n this.fs.API.put(path, stream.file);\n }\n stream.file = undefined;\n }\n read(stream, buffer, offset, length, position) {\n if (length <= 0 ||\n stream.file === undefined ||\n position >= (stream.file.data.length || 0)) {\n return 0;\n }\n const size = Math.min(stream.file.data.length - position, length);\n buffer.set(stream.file.data.subarray(position, position + size), offset);\n return size;\n }\n write(stream, buffer, offset, length, position) {\n var _a;\n if (length <= 0 || stream.file === undefined) {\n return 0;\n }\n stream.node.timestamp = Date.now();\n if (position + length > (((_a = stream.file) === null || _a === void 0 ? void 0 : _a.data.length) || 0)) {\n const oldData = stream.file.data ? stream.file.data : new Uint8Array();\n stream.file.data = new Uint8Array(position + length);\n stream.file.data.set(oldData);\n }\n stream.file.data.set(buffer.subarray(offset, offset + length), position);\n return length;\n }\n llseek(stream, offset, whence) {\n let position = offset;\n if (whence === SEEK_CUR) {\n position += stream.position;\n }\n else if (whence === SEEK_END) {\n if (this.fs.FS.isFile(stream.node.mode)) {\n if (stream.file !== undefined) {\n position += stream.file.data.length;\n }\n else {\n throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.EPERM);\n }\n }\n }\n if (position < 0) {\n throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES.EINVAL);\n }\n return position;\n }\n}\nexport class DriveFSEmscriptenNodeOps {\n constructor(fs) {\n this.fs = fs;\n }\n getattr(node) {\n return {\n ...this.fs.API.getattr(this.fs.realPath(node)),\n mode: node.mode,\n ino: node.id,\n };\n }\n setattr(node, attr) {\n for (const [key, value] of Object.entries(attr)) {\n switch (key) {\n case 'mode':\n node.mode = value;\n break;\n case 'timestamp':\n node.timestamp = value;\n break;\n default:\n console.warn('setattr', key, 'of', value, 'on', node, 'not yet implemented');\n break;\n }\n }\n }\n lookup(parent, name) {\n const path = this.fs.PATH.join2(this.fs.realPath(parent), name);\n const result = this.fs.API.lookup(path);\n if (!result.ok) {\n throw this.fs.FS.genericErrors[this.fs.ERRNO_CODES['ENOENT']];\n }\n return this.fs.createNode(parent, name, result.mode, 0);\n }\n mknod(parent, name, mode, dev) {\n const path = this.fs.PATH.join2(this.fs.realPath(parent), name);\n this.fs.API.mknod(path, mode);\n return this.fs.createNode(parent, name, mode, dev);\n }\n rename(oldNode, newDir, newName) {\n this.fs.API.rename(oldNode.parent\n ? this.fs.PATH.join2(this.fs.realPath(oldNode.parent), oldNode.name)\n : oldNode.name, this.fs.PATH.join2(this.fs.realPath(newDir), newName));\n // Updating the in-memory node\n oldNode.name = newName;\n oldNode.parent = newDir;\n }\n unlink(parent, name) {\n this.fs.API.rmdir(this.fs.PATH.join2(this.fs.realPath(parent), name));\n }\n rmdir(parent, name) {\n this.fs.API.rmdir(this.fs.PATH.join2(this.fs.realPath(parent), name));\n }\n readdir(node) {\n return this.fs.API.readdir(this.fs.realPath(node));\n }\n symlink(parent, newName, oldPath) {\n throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES['EPERM']);\n }\n readlink(node) {\n throw new this.fs.FS.ErrnoError(this.fs.ERRNO_CODES['EPERM']);\n }\n}\n/**\n * Wrap ServiceWorker requests for an Emscripten-compatible synchronous API.\n */\nexport class ContentsAPI {\n constructor(baseUrl, driveName, mountpoint, FS, ERRNO_CODES) {\n this._baseUrl = baseUrl;\n this._driveName = driveName;\n this._mountpoint = mountpoint;\n this.FS = FS;\n this.ERRNO_CODES = ERRNO_CODES;\n }\n request(data) {\n const xhr = new XMLHttpRequest();\n xhr.open('POST', encodeURI(this.endpoint), false);\n try {\n xhr.send(JSON.stringify(data));\n }\n catch (e) {\n console.error(e);\n }\n if (xhr.status >= 400) {\n throw new this.FS.ErrnoError(this.ERRNO_CODES['EINVAL']);\n }\n return JSON.parse(xhr.responseText);\n }\n lookup(path) {\n return this.request({ method: 'lookup', path: this.normalizePath(path) });\n }\n getmode(path) {\n return Number.parseInt(this.request({ method: 'getmode', path: this.normalizePath(path) }));\n }\n mknod(path, mode) {\n return this.request({\n method: 'mknod',\n path: this.normalizePath(path),\n data: { mode },\n });\n }\n rename(oldPath, newPath) {\n return this.request({\n method: 'rename',\n path: this.normalizePath(oldPath),\n data: { newPath: this.normalizePath(newPath) },\n });\n }\n readdir(path) {\n const dirlist = this.request({\n method: 'readdir',\n path: this.normalizePath(path),\n });\n dirlist.push('.');\n dirlist.push('..');\n return dirlist;\n }\n rmdir(path) {\n return this.request({ method: 'rmdir', path: this.normalizePath(path) });\n }\n get(path) {\n const response = this.request({ method: 'get', path: this.normalizePath(path) });\n const serializedContent = response.content;\n const format = response.format;\n switch (format) {\n case 'json':\n case 'text':\n return {\n data: encoder.encode(serializedContent),\n format,\n };\n case 'base64': {\n const binString = atob(serializedContent);\n const len = binString.length;\n const data = new Uint8Array(len);\n for (let i = 0; i < len; i++) {\n data[i] = binString.charCodeAt(i);\n }\n return {\n data,\n format,\n };\n }\n default:\n throw new this.FS.ErrnoError(this.ERRNO_CODES['ENOENT']);\n }\n }\n put(path, value) {\n switch (value.format) {\n case 'json':\n case 'text':\n return this.request({\n method: 'put',\n path: this.normalizePath(path),\n data: {\n format: value.format,\n data: decoder.decode(value.data),\n },\n });\n case 'base64': {\n let binary = '';\n for (let i = 0; i < value.data.byteLength; i++) {\n binary += String.fromCharCode(value.data[i]);\n }\n return this.request({\n method: 'put',\n path: this.normalizePath(path),\n data: {\n format: value.format,\n data: btoa(binary),\n },\n });\n }\n }\n }\n getattr(path) {\n const stats = this.request({\n method: 'getattr',\n path: this.normalizePath(path),\n });\n // Turn datetimes into proper objects\n stats.atime = new Date(stats.atime);\n stats.mtime = new Date(stats.mtime);\n stats.ctime = new Date(stats.ctime);\n // ensure a non-undefined size (0 isn't great, though)\n stats.size = stats.size || 0;\n return stats;\n }\n /**\n * Normalize a Path by making it compliant for the content manager\n *\n * @param path: the path relatively to the Emscripten drive\n */\n normalizePath(path) {\n // Remove mountpoint prefix\n if (path.startsWith(this._mountpoint)) {\n path = path.slice(this._mountpoint.length);\n }\n // Add JupyterLab drive name\n if (this._driveName) {\n path = `${this._driveName}${DRIVE_SEPARATOR}${path}`;\n }\n return path;\n }\n /**\n * Get the api/drive endpoint\n */\n get endpoint() {\n return `${this._baseUrl}api/drive`;\n }\n}\nexport class DriveFS {\n constructor(options) {\n this.FS = options.FS;\n this.PATH = options.PATH;\n this.ERRNO_CODES = options.ERRNO_CODES;\n this.API = new ContentsAPI(options.baseUrl, options.driveName, options.mountpoint, this.FS, this.ERRNO_CODES);\n this.driveName = options.driveName;\n this.node_ops = new DriveFSEmscriptenNodeOps(this);\n this.stream_ops = new DriveFSEmscriptenStreamOps(this);\n }\n mount(mount) {\n return this.createNode(null, mount.mountpoint, DIR_MODE | 511, 0);\n }\n createNode(parent, name, mode, dev) {\n const FS = this.FS;\n if (!FS.isDir(mode) && !FS.isFile(mode)) {\n throw new FS.ErrnoError(this.ERRNO_CODES['EINVAL']);\n }\n const node = FS.createNode(parent, name, mode, dev);\n node.node_ops = this.node_ops;\n node.stream_ops = this.stream_ops;\n return node;\n }\n getMode(path) {\n return this.API.getmode(path);\n }\n realPath(node) {\n const parts = [];\n let currentNode = node;\n parts.push(currentNode.name);\n while (currentNode.parent !== currentNode) {\n currentNode = currentNode.parent;\n parts.push(currentNode.name);\n }\n parts.reverse();\n return this.PATH.join.apply(null, parts);\n }\n}\n//# sourceMappingURL=drivefs.js.map","// Copyright (c) Thorsten Beier\n// Copyright (c) JupyterLite Contributors\n// Distributed under the terms of the Modified BSD License.\nconsole.log('worker loaded');\nimport { expose } from 'comlink';\nimport { DriveFS, DriveFSEmscriptenNodeOps } from '@jupyterlite/contents';\nglobalThis.Module = {};\nclass StreamNodeOps extends DriveFSEmscriptenNodeOps {\n getNode(nodeOrStream) {\n if (nodeOrStream['node']) {\n return nodeOrStream['node'];\n }\n return nodeOrStream;\n }\n lookup(parent, name) {\n return super.lookup(this.getNode(parent), name);\n }\n getattr(node) {\n return super.getattr(this.getNode(node));\n }\n setattr(node, attr) {\n super.setattr(this.getNode(node), attr);\n }\n mknod(parent, name, mode, dev) {\n return super.mknod(this.getNode(parent), name, mode, dev);\n }\n rename(oldNode, newDir, newName) {\n super.rename(this.getNode(oldNode), this.getNode(newDir), newName);\n }\n rmdir(parent, name) {\n super.rmdir(this.getNode(parent), name);\n }\n readdir(node) {\n return super.readdir(this.getNode(node));\n }\n}\n// TODO Remove this when we don't need StreamNodeOps anymore\nclass LoggingDrive extends DriveFS {\n constructor(options) {\n super(options);\n this.node_ops = new StreamNodeOps(this);\n }\n}\n// when a toplevel cell uses an await, the cell is implicitly\n// wrapped in a async function. Since the webloop - eventloop\n// implementation does not support `eventloop.run_until_complete(f)`\n// we need to convert the toplevel future in a javascript Promise\n// this `toplevel` promise is then awaited before we\n// execute the next cell. After the promise is awaited we need\n// to do some cleanup and delete the python proxy\n// (ie a js-wrapped python object) to avoid memory leaks\nglobalThis.toplevel_promise = null;\nglobalThis.toplevel_promise_py_proxy = null;\nlet resolveInputReply;\nasync function get_stdin() {\n const replyPromise = new Promise(resolve => {\n resolveInputReply = resolve;\n });\n return replyPromise;\n}\nself.get_stdin = get_stdin;\nclass XeusKernel {\n constructor(resolve) {\n this._drive = null;\n console.log('constructing kernel');\n this._resolve = resolve;\n }\n async ready() {\n return await globalThis.ready;\n }\n mount(driveName, mountpoint, baseUrl) {\n console.log('mounting drive');\n const { FS, PATH, ERRNO_CODES } = globalThis.Module;\n if (!FS) {\n return;\n }\n this._drive = new LoggingDrive({\n FS,\n PATH,\n ERRNO_CODES,\n baseUrl,\n driveName,\n mountpoint\n });\n FS.mkdir(mountpoint);\n FS.mount(this._drive, {}, mountpoint);\n FS.chdir(mountpoint);\n }\n cd(path) {\n if (!path || !globalThis.Module.FS) {\n return;\n }\n globalThis.Module.FS.chdir(path);\n }\n async processMessage(event) {\n const msg_type = event.msg.header.msg_type;\n if (msg_type === '__initialize__') {\n this._kernelspec = event.msg.kernelspec;\n await this.initialize();\n return;\n }\n await this.ready();\n if (globalThis.toplevel_promise !== null &&\n globalThis.toplevel_promise_py_proxy !== null) {\n await globalThis.toplevel_promise;\n globalThis.toplevel_promise_py_proxy.delete();\n globalThis.toplevel_promise_py_proxy = null;\n globalThis.toplevel_promise = null;\n }\n if (msg_type === 'input_reply') {\n resolveInputReply(event.msg);\n }\n else {\n this._raw_xserver.notify_listener(event.msg);\n }\n }\n async initialize() {\n // the location of the kernel on the server\n // ie `share/jupyter/kernels/${dir}`\n const dir = this._kernelspec.dir;\n // location of the kernel binary on the server\n const binary_js = this._kernelspec.argv[0];\n const binary_wasm = binary_js.replace('.js', '.wasm');\n importScripts(binary_js);\n globalThis.Module = await createXeusModule({\n locateFile: (file) => {\n if (file.endsWith('.wasm')) {\n return binary_wasm;\n }\n return file;\n }\n });\n try {\n await this.waitRunDependency();\n console.log(globalThis.Module);\n // each kernel can have a `async_init` function\n // which can do kernel specific **async** initialization\n // This function is usually implemented in the pre/post.js\n // in the emscripten build of that kernel\n if (globalThis.Module['async_init'] !== undefined) {\n const kernel_root_url = `share/jupyter/kernels/${dir}`;\n const pkg_root_url = 'share/jupyter/kernel_packages';\n const verbose = true;\n await globalThis.Module['async_init'](kernel_root_url, pkg_root_url, verbose);\n }\n await this.waitRunDependency();\n this._raw_xkernel = new globalThis.Module.xkernel();\n this._raw_xserver = this._raw_xkernel.get_server();\n if (!this._raw_xkernel) {\n console.error('Failed to start kernel!');\n }\n this._raw_xkernel.start();\n }\n catch (e) {\n if (typeof e === 'number') {\n const msg = globalThis.Module.get_exception_message(e);\n console.error(msg);\n throw new Error(msg);\n }\n else {\n console.error(e);\n throw e;\n }\n }\n this._resolve();\n }\n async waitRunDependency() {\n const promise = new Promise(resolve => {\n globalThis.Module.monitorRunDependencies = (n) => {\n if (n === 0) {\n resolve();\n }\n };\n });\n // If there are no pending dependencies left, monitorRunDependencies will\n // never be called. Since we can't check the number of dependencies,\n // manually trigger a call.\n globalThis.Module.addRunDependency('dummy');\n globalThis.Module.removeRunDependency('dummy');\n return promise;\n }\n}\nglobalThis.ready = new Promise(resolve => {\n console.log('expose(new XeusKernel(resolve));');\n expose(new XeusKernel(resolve));\n});\n"],"names":["exports","Symbol","toStringTag","Object","defineProperty","value","proxyMarker","createEndpoint","releaseProxy","finalizer","throwMarker","isObject","val","transferHandlers","Map","canHandle","serialize","obj","port1","port2","MessageChannel","expose","deserialize","port","start","createProxy","target","serialized","Error","isError","message","name","stack","assign","ep","globalThis","allowedOrigins","addEventListener","callback","ev","data","origin","allowedOrigin","RegExp","test","isAllowedOrigin","console","warn","id","type","path","argumentList","map","fromWireValue","returnValue","parent","slice","reduce","prop","rawValue","apply","proxy","transfers","transferCache","set","transfer","undefined","Promise","resolve","catch","then","wireValue","transferables","toWireValue","postMessage","removeEventListener","closeEndPoint","error","TypeError","endpoint","constructor","isMessagePort","close","throwIfProxyReleased","isReleased","releaseEndpoint","requestResponseMessage","proxyCounter","WeakMap","proxyFinalizers","FinalizationRegistry","newCount","get","isProxyReleased","Proxy","_target","unregister","unregisterProxy","length","r","p","toString","bind","_thisArg","rawArgumentList","last","processArguments","construct","register","registerProxy","processed","v","arr","Array","prototype","concat","handler","serializedValue","msg","fill","Math","floor","random","Number","MAX_SAFE_INTEGER","join","l","encoder","TextEncoder","decoder","TextDecoder","flagNeedsWrite","DriveFSEmscriptenStreamOps","fs","this","open","stream","realPath","node","FS","isFile","mode","file","API","flags","parsedFlags","parseInt","needsWrite","put","read","buffer","offset","position","size","min","subarray","write","_a","timestamp","Date","now","oldData","Uint8Array","llseek","whence","ErrnoError","ERRNO_CODES","EPERM","EINVAL","DriveFSEmscriptenNodeOps","getattr","ino","setattr","attr","key","entries","lookup","PATH","join2","result","ok","genericErrors","createNode","mknod","dev","rename","oldNode","newDir","newName","unlink","rmdir","readdir","symlink","oldPath","readlink","ContentsAPI","baseUrl","driveName","mountpoint","_baseUrl","_driveName","_mountpoint","request","xhr","XMLHttpRequest","encodeURI","send","JSON","stringify","e","status","parse","responseText","method","normalizePath","getmode","newPath","dirlist","push","response","serializedContent","content","format","encode","binString","atob","len","i","charCodeAt","decode","binary","byteLength","String","fromCharCode","btoa","stats","atime","mtime","ctime","startsWith","DriveFS","options","node_ops","stream_ops","mount","DIR_MODE","isDir","getMode","parts","currentNode","reverse","log","Module","StreamNodeOps","getNode","nodeOrStream","super","LoggingDrive","resolveInputReply","toplevel_promise","toplevel_promise_py_proxy","self","get_stdin","async","XeusKernel","_drive","_resolve","ready","mkdir","chdir","cd","processMessage","event","msg_type","header","_kernelspec","kernelspec","initialize","delete","_raw_xserver","notify_listener","dir","binary_js","argv","binary_wasm","replace","importScripts","createXeusModule","locateFile","endsWith","waitRunDependency","kernel_root_url","pkg_root_url","verbose","_raw_xkernel","xkernel","get_server","get_exception_message","promise","monitorRunDependencies","n","addRunDependency","removeRunDependency"],"sourceRoot":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@jupyterlite/xeus",
|
|
3
|
+
"version": "0.1.0-a1",
|
|
4
|
+
"description": "JupyterLite loader for Xeus kernels",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"jupyter",
|
|
7
|
+
"jupyterlab",
|
|
8
|
+
"jupyterlab-extension"
|
|
9
|
+
],
|
|
10
|
+
"homepage": "https://github.com/jupyterlite/xeus",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/jupyterlite/xeus/issues"
|
|
13
|
+
},
|
|
14
|
+
"license": "BSD-3-Clause",
|
|
15
|
+
"author": "JupyterLite Contributors",
|
|
16
|
+
"files": [
|
|
17
|
+
"lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}",
|
|
18
|
+
"style/**/*.{css,js,eot,gif,html,jpg,json,png,svg,woff2,ttf}"
|
|
19
|
+
],
|
|
20
|
+
"main": "lib/index.js",
|
|
21
|
+
"types": "lib/index.d.ts",
|
|
22
|
+
"style": "style/index.css",
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "https://github.com/jupyterlite/xeus.git"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "jlpm build:lib && jlpm build:worker && jlpm build:labextension:dev",
|
|
29
|
+
"build:prod": "jlpm clean && jlpm build:lib:prod && jlpm build:worker:prod && jlpm build:labextension",
|
|
30
|
+
"build:worker": "webpack --config worker.webpack.config.js --mode=development",
|
|
31
|
+
"build:worker:prod": "webpack --config worker.webpack.config.js --mode=production",
|
|
32
|
+
"build:labextension": "jupyter labextension build .",
|
|
33
|
+
"build:labextension:dev": "jupyter labextension build --development True .",
|
|
34
|
+
"build:lib": "tsc --sourceMap",
|
|
35
|
+
"build:lib:prod": "tsc",
|
|
36
|
+
"clean": "jlpm clean:lib",
|
|
37
|
+
"clean:lib": "rimraf lib tsconfig.tsbuildinfo",
|
|
38
|
+
"clean:lintcache": "rimraf .eslintcache .stylelintcache",
|
|
39
|
+
"clean:labextension": "rimraf jupyterlite_xeus/labextension jupyterlite_xeus/_version.py",
|
|
40
|
+
"clean:all": "jlpm clean:lib && jlpm clean:labextension && jlpm clean:lintcache",
|
|
41
|
+
"eslint": "jlpm eslint:check --fix",
|
|
42
|
+
"eslint:check": "eslint . --cache --ext .ts,.tsx",
|
|
43
|
+
"install:extension": "jlpm build",
|
|
44
|
+
"lint": "jlpm stylelint && jlpm prettier && jlpm eslint",
|
|
45
|
+
"lint:check": "jlpm stylelint:check && jlpm prettier:check && jlpm eslint:check",
|
|
46
|
+
"prettier": "jlpm prettier:base --write --list-different",
|
|
47
|
+
"prettier:base": "prettier \"**/*{.ts,.tsx,.js,.jsx,.css,.json,.md}\"",
|
|
48
|
+
"prettier:check": "jlpm prettier:base --check",
|
|
49
|
+
"stylelint": "jlpm stylelint:check --fix",
|
|
50
|
+
"stylelint:check": "stylelint --cache \"style/**/*.css\"",
|
|
51
|
+
"test": "jest --coverage",
|
|
52
|
+
"watch": "run-p watch:src watch:labextension",
|
|
53
|
+
"watch:src": "tsc -w --sourceMap",
|
|
54
|
+
"watch:labextension": "jupyter labextension watch ."
|
|
55
|
+
},
|
|
56
|
+
"dependencies": {
|
|
57
|
+
"@jupyterlab/coreutils": "^6",
|
|
58
|
+
"@jupyterlab/services": "^7",
|
|
59
|
+
"@jupyterlite/contents": "^0.2.0",
|
|
60
|
+
"@jupyterlite/kernel": "^0.2.0",
|
|
61
|
+
"@jupyterlite/server": "^0.2.0",
|
|
62
|
+
"@lumino/coreutils": "^2",
|
|
63
|
+
"@lumino/signaling": "^2",
|
|
64
|
+
"comlink": "^4.3.1"
|
|
65
|
+
},
|
|
66
|
+
"devDependencies": {
|
|
67
|
+
"@jupyterlab/builder": "^4.0.0",
|
|
68
|
+
"@jupyterlab/testutils": "^4.0.0",
|
|
69
|
+
"@types/jest": "^29.2.0",
|
|
70
|
+
"@types/json-schema": "^7.0.11",
|
|
71
|
+
"@types/react": "^18.0.26",
|
|
72
|
+
"@types/react-addons-linked-state-mixin": "^0.14.22",
|
|
73
|
+
"@typescript-eslint/eslint-plugin": "^6.1.0",
|
|
74
|
+
"@typescript-eslint/parser": "^6.1.0",
|
|
75
|
+
"css-loader": "^6.7.1",
|
|
76
|
+
"eslint": "^8.36.0",
|
|
77
|
+
"eslint-config-prettier": "^8.8.0",
|
|
78
|
+
"eslint-plugin-prettier": "^5.0.0",
|
|
79
|
+
"jest": "^29.2.0",
|
|
80
|
+
"npm-run-all": "^4.1.5",
|
|
81
|
+
"prettier": "^3.0.0",
|
|
82
|
+
"rimraf": "^5.0.1",
|
|
83
|
+
"source-map-loader": "^1.0.2",
|
|
84
|
+
"style-loader": "^3.3.1",
|
|
85
|
+
"stylelint": "^15.10.1",
|
|
86
|
+
"stylelint-config-recommended": "^13.0.0",
|
|
87
|
+
"stylelint-config-standard": "^34.0.0",
|
|
88
|
+
"stylelint-csstree-validator": "^3.0.0",
|
|
89
|
+
"stylelint-prettier": "^4.0.0",
|
|
90
|
+
"ts-loader": "^9.2.6",
|
|
91
|
+
"typescript": "~5.0.2",
|
|
92
|
+
"webpack": "^5.87.0",
|
|
93
|
+
"yjs": "^13.5.0"
|
|
94
|
+
},
|
|
95
|
+
"sideEffects": [
|
|
96
|
+
"style/*.css",
|
|
97
|
+
"style/index.js"
|
|
98
|
+
],
|
|
99
|
+
"styleModule": "style/index.js",
|
|
100
|
+
"publishConfig": {
|
|
101
|
+
"access": "public"
|
|
102
|
+
},
|
|
103
|
+
"jupyterlab": {
|
|
104
|
+
"extension": true,
|
|
105
|
+
"outputDir": "jupyterlite_xeus/labextension",
|
|
106
|
+
"sharedPackages": {
|
|
107
|
+
"@jupyterlite/kernel": {
|
|
108
|
+
"bundled": false,
|
|
109
|
+
"singleton": true
|
|
110
|
+
},
|
|
111
|
+
"@jupyterlite/server": {
|
|
112
|
+
"bundled": false,
|
|
113
|
+
"singleton": true
|
|
114
|
+
},
|
|
115
|
+
"@jupyterlite/contents": {
|
|
116
|
+
"bundled": false,
|
|
117
|
+
"singleton": true
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
"jupyterlite": {
|
|
122
|
+
"liteExtension": true
|
|
123
|
+
},
|
|
124
|
+
"eslintIgnore": [
|
|
125
|
+
"node_modules",
|
|
126
|
+
"dist",
|
|
127
|
+
"coverage",
|
|
128
|
+
"**/*.d.ts",
|
|
129
|
+
"tests",
|
|
130
|
+
"**/__tests__",
|
|
131
|
+
"ui-tests"
|
|
132
|
+
],
|
|
133
|
+
"eslintConfig": {
|
|
134
|
+
"extends": [
|
|
135
|
+
"eslint:recommended",
|
|
136
|
+
"plugin:@typescript-eslint/eslint-recommended",
|
|
137
|
+
"plugin:@typescript-eslint/recommended",
|
|
138
|
+
"plugin:prettier/recommended"
|
|
139
|
+
],
|
|
140
|
+
"parser": "@typescript-eslint/parser",
|
|
141
|
+
"parserOptions": {
|
|
142
|
+
"project": "tsconfig.json",
|
|
143
|
+
"sourceType": "module"
|
|
144
|
+
},
|
|
145
|
+
"plugins": [
|
|
146
|
+
"@typescript-eslint"
|
|
147
|
+
],
|
|
148
|
+
"rules": {
|
|
149
|
+
"@typescript-eslint/naming-convention": [
|
|
150
|
+
"error",
|
|
151
|
+
{
|
|
152
|
+
"selector": "interface",
|
|
153
|
+
"format": [
|
|
154
|
+
"PascalCase"
|
|
155
|
+
],
|
|
156
|
+
"custom": {
|
|
157
|
+
"regex": "^I[A-Z]",
|
|
158
|
+
"match": true
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
],
|
|
162
|
+
"@typescript-eslint/no-unused-vars": [
|
|
163
|
+
"warn",
|
|
164
|
+
{
|
|
165
|
+
"args": "none"
|
|
166
|
+
}
|
|
167
|
+
],
|
|
168
|
+
"@typescript-eslint/no-explicit-any": "off",
|
|
169
|
+
"@typescript-eslint/no-namespace": "off",
|
|
170
|
+
"@typescript-eslint/no-use-before-define": "off",
|
|
171
|
+
"@typescript-eslint/quotes": [
|
|
172
|
+
"error",
|
|
173
|
+
"single",
|
|
174
|
+
{
|
|
175
|
+
"avoidEscape": true,
|
|
176
|
+
"allowTemplateLiterals": false
|
|
177
|
+
}
|
|
178
|
+
],
|
|
179
|
+
"curly": [
|
|
180
|
+
"error",
|
|
181
|
+
"all"
|
|
182
|
+
],
|
|
183
|
+
"eqeqeq": "error",
|
|
184
|
+
"prefer-arrow-callback": "error"
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
"prettier": {
|
|
188
|
+
"singleQuote": true,
|
|
189
|
+
"trailingComma": "none",
|
|
190
|
+
"arrowParens": "avoid",
|
|
191
|
+
"endOfLine": "auto",
|
|
192
|
+
"overrides": [
|
|
193
|
+
{
|
|
194
|
+
"files": "package.json",
|
|
195
|
+
"options": {
|
|
196
|
+
"tabWidth": 4
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
]
|
|
200
|
+
},
|
|
201
|
+
"stylelint": {
|
|
202
|
+
"extends": [
|
|
203
|
+
"stylelint-config-recommended",
|
|
204
|
+
"stylelint-config-standard",
|
|
205
|
+
"stylelint-prettier/recommended"
|
|
206
|
+
],
|
|
207
|
+
"plugins": [
|
|
208
|
+
"stylelint-csstree-validator"
|
|
209
|
+
],
|
|
210
|
+
"rules": {
|
|
211
|
+
"csstree/validator": true,
|
|
212
|
+
"property-no-vendor-prefix": null,
|
|
213
|
+
"selector-class-pattern": "^([a-z][A-z\\d]*)(-[A-z\\d]+)*$",
|
|
214
|
+
"selector-no-vendor-prefix": null,
|
|
215
|
+
"value-no-vendor-prefix": null
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
package/style/base.css
ADDED
package/style/index.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import url('base.css');
|
package/style/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './base.css';
|