Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to coincident v2 #104

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,5 @@ env.yml

# Jupyterlite cache
.jupyterlite.doit.db
_output

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"@jupyterlite/server": "^0.2.0 || ^0.3.0 || ^0.4.0",
"@lumino/coreutils": "^2",
"@lumino/signaling": "^2",
"coincident": "^1.2.3"
"coincident": "^2.0.0"
},
"devDependencies": {
"@jupyterlab/builder": "^4.1.0",
Expand Down
18 changes: 12 additions & 6 deletions src/web_worker_kernel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
// Copyright (c) JupyterLite Contributors
// Distributed under the terms of the Modified BSD License.

import coincident from 'coincident';
// @ts-expect-error - no types available
import coincident from 'coincident/main';

const { Worker: CoincidentWorker } = coincident();

import { ISignal, Signal } from '@lumino/signaling';
import { PromiseDelegate } from '@lumino/coreutils';
Expand Down Expand Up @@ -48,14 +51,17 @@ export class WebWorkerKernel implements IKernel {
this._kernelspec = kernelspec;
this._contentsManager = contentsManager;
this._sendMessage = sendMessage;
this._worker = new Worker(new URL('./worker.js', import.meta.url), {
type: 'module'
});

const worker = new CoincidentWorker(
new URL('./worker.js', import.meta.url),
{
type: 'module'
}
);
this._worker = worker;
this._remote = worker.proxy;
this._worker.onmessage = this._processWorkerMessage.bind(this);

this._remote = coincident(this._worker) as IXeusKernel;

this.setupFilesystemAPIs();

this._remote.initialize(this._kernelspec, PageConfig.getBaseUrl());
Expand Down
5 changes: 3 additions & 2 deletions src/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
// Copyright (c) JupyterLite Contributors
// Distributed under the terms of the Modified BSD License.

import coincident from 'coincident';
// @ts-expect-error - no types available
import coincident from 'coincident/worker';

import {
ContentsAPI,
Expand All @@ -19,7 +20,7 @@ declare function createXeusModule(options: any): any;

globalThis.Module = {};

const workerAPI = coincident(self) as typeof globalThis;
const { proxy: workerAPI } = await coincident();

/**
* An Emscripten-compatible synchronous Contents API using shared array buffers.
Expand Down
47 changes: 27 additions & 20 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ __metadata:
"@types/react-addons-linked-state-mixin": ^0.14.22
"@typescript-eslint/eslint-plugin": ^6.1.0
"@typescript-eslint/parser": ^6.1.0
coincident: ^1.2.3
coincident: ^2.0.0
css-loader: ^6.7.1
eslint: ^8.36.0
eslint-config-prettier: ^8.8.0
Expand Down Expand Up @@ -954,13 +954,6 @@ __metadata:
languageName: node
linkType: hard

"@ungap/with-resolvers@npm:^0.1.0":
version: 0.1.0
resolution: "@ungap/with-resolvers@npm:0.1.0"
checksum: ac0c6234414b87ec26e9603c5e57f6ae48477ccc901841e725e820bc026367987cc82dbdb8c702e058179dadbd16578c0fcc607d2122e72d9fe91373bade126c
languageName: node
linkType: hard

"@webassemblyjs/ast@npm:1.12.1, @webassemblyjs/ast@npm:^1.12.1":
version: 1.12.1
resolution: "@webassemblyjs/ast@npm:1.12.1"
Expand Down Expand Up @@ -1517,19 +1510,14 @@ __metadata:
languageName: node
linkType: hard

"coincident@npm:^1.2.3":
version: 1.2.3
resolution: "coincident@npm:1.2.3"
"coincident@npm:^2.0.0":
version: 2.0.0
resolution: "coincident@npm:2.0.0"
dependencies:
"@ungap/structured-clone": ^1.2.0
"@ungap/with-resolvers": ^0.1.0
gc-hook: ^0.3.1
proxy-target: ^3.0.2
ws: ^8.16.0
dependenciesMeta:
ws:
optional: true
checksum: 21c44d9d74be393b12d6f91c885c8b6c640dce570b01b5d5156327488390c858de8e40c0af08763e3cd7041bcf32bee70c058a1b24aa25b145376a92b1c520a3
js-proxy: ^0.4.3
sabayon: ^0.5.0
checksum: 95c71cdb33787ab8737cd084eb984ce15076f71bc8590fb565e892e624a6f0e7aa7eef00e3edace31e5f5e12938e91631041aa0f3f9a7aef8f8b1a100527b9a7
languageName: node
linkType: hard

Expand Down Expand Up @@ -3067,6 +3055,16 @@ __metadata:
languageName: node
linkType: hard

"js-proxy@npm:^0.4.3":
version: 0.4.3
resolution: "js-proxy@npm:0.4.3"
dependencies:
gc-hook: ^0.3.1
proxy-target: ^3.0.2
checksum: d97c54dcf725523090973d39741edb3154034b542dfb88f8374b729cd98fa7d1bb2e0e4f59e74ec64126be10a53601ea97517baddbdf566ecb744bfe99edb506
languageName: node
linkType: hard

"js-tokens@npm:^4.0.0":
version: 4.0.0
resolution: "js-tokens@npm:4.0.0"
Expand Down Expand Up @@ -4222,6 +4220,15 @@ __metadata:
languageName: node
linkType: hard

"sabayon@npm:^0.5.0":
version: 0.5.0
resolution: "sabayon@npm:0.5.0"
bin:
sabayon: cli.cjs
checksum: 2ca246ae483cbd49d147c55d32bde13fff370a713f3c00c122823ad9c395db1a5e8411a64f0807b9a8234ccd989750f7f428de7d08073fecc488d44dd038fe48
languageName: node
linkType: hard

"safe-array-concat@npm:^1.1.2":
version: 1.1.2
resolution: "safe-array-concat@npm:1.1.2"
Expand Down Expand Up @@ -5373,7 +5380,7 @@ __metadata:
languageName: node
linkType: hard

"ws@npm:^8.11.0, ws@npm:^8.16.0":
"ws@npm:^8.11.0":
version: 8.17.0
resolution: "ws@npm:8.17.0"
peerDependencies:
Expand Down
Loading