From f4e79941990612e670885dec1250111caa3793ea Mon Sep 17 00:00:00 2001 From: Jeremy Tuloup Date: Mon, 29 Jul 2024 13:56:26 +0200 Subject: [PATCH 1/4] Update to coincident v2 --- package.json | 2 +- yarn.lock | 47 +++++++++++++++++++++++++++-------------------- 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/package.json b/package.json index 27e0faf..9e003e2 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/yarn.lock b/yarn.lock index 73011db..f3273b6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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 @@ -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" @@ -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 @@ -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" @@ -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" @@ -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: From c1bba530a4fc1a8ddbc4180bda05136f777772f3 Mon Sep 17 00:00:00 2001 From: Jeremy Tuloup Date: Mon, 29 Jul 2024 15:07:28 +0200 Subject: [PATCH 2/4] try fixes for v2 --- src/web_worker_kernel.ts | 18 ++++++++++++------ src/worker.ts | 5 +++-- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/web_worker_kernel.ts b/src/web_worker_kernel.ts index e11e2ce..bdacd9e 100644 --- a/src/web_worker_kernel.ts +++ b/src/web_worker_kernel.ts @@ -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'; @@ -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()); diff --git a/src/worker.ts b/src/worker.ts index 7180b15..96469de 100644 --- a/src/worker.ts +++ b/src/worker.ts @@ -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, @@ -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. From dc97a3295661556facb6ca49d18ae837655198c3 Mon Sep 17 00:00:00 2001 From: Jeremy Tuloup Date: Tue, 30 Jul 2024 16:13:47 +0200 Subject: [PATCH 3/4] try without URL --- src/web_worker_kernel.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/web_worker_kernel.ts b/src/web_worker_kernel.ts index bdacd9e..f9f1ecb 100644 --- a/src/web_worker_kernel.ts +++ b/src/web_worker_kernel.ts @@ -52,12 +52,7 @@ export class WebWorkerKernel implements IKernel { this._contentsManager = contentsManager; this._sendMessage = sendMessage; - const worker = new CoincidentWorker( - new URL('./worker.js', import.meta.url), - { - type: 'module' - } - ); + const worker = new CoincidentWorker('./worker.js'); this._worker = worker; this._remote = worker.proxy; this._worker.onmessage = this._processWorkerMessage.bind(this); From 21fe39965f9660c47f8484763e0b218d42212467 Mon Sep 17 00:00:00 2001 From: Jeremy Tuloup Date: Wed, 31 Jul 2024 09:57:05 +0200 Subject: [PATCH 4/4] url --- .gitignore | 2 ++ src/web_worker_kernel.ts | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index c080c6f..a094877 100644 --- a/.gitignore +++ b/.gitignore @@ -130,3 +130,5 @@ env.yml # Jupyterlite cache .jupyterlite.doit.db +_output + diff --git a/src/web_worker_kernel.ts b/src/web_worker_kernel.ts index f9f1ecb..bdacd9e 100644 --- a/src/web_worker_kernel.ts +++ b/src/web_worker_kernel.ts @@ -52,7 +52,12 @@ export class WebWorkerKernel implements IKernel { this._contentsManager = contentsManager; this._sendMessage = sendMessage; - const worker = new CoincidentWorker('./worker.js'); + 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);