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

Remove WebWorker code that is now in cockle #21

Merged
merged 8 commits into from
Sep 12, 2024
Merged

Conversation

ianthomas23
Copy link
Member

@ianthomas23 ianthomas23 commented Sep 5, 2024

This is an attempt to upgrade from cockle 0.0.5 to 0.0.7. The WebWorker code is now in cockle and hence needs to be removed from this repo, making this much simpler.

It is not yet working as the WebWorker is not yet being initialised correctly. Originally I thought this was a problem with the worker.webpack.config.js but I don't believe this is required any longer as the normal build process creates the webworker JS file in the correct place in the _output directory. I have confirmed this by replacing the cockle shell_impl.js with something much simpler that has no dependencies and just writes some debug messages to the console, and that works fine. So the problem appears to be with webpack trying to load @jupyterlite/contents which is seems to do recursively. I am experimenting with setting this package as one of the singletonPackages.

@ianthomas23 ianthomas23 added the enhancement New feature or request label Sep 5, 2024
@ianthomas23
Copy link
Member Author

This now works, the singletonPackages was a red herring.

Now we are using the WebWorker shell_impl.js code that is pre-bundled in cockle 0.0.8 and extra webpack config in webpack.extra.config.js that is used by the labextension build process to use the prebundled worker code rather than bundling it itself. The approach of bundling it itself, which happens here by default if not overridden, works for everything except the use of @jupyterlite/contents to include DriveFS, so the longer term solution here should be a different webpack config to deal with just this problem such that we can remove the need for cockle to pre-bundle anything.

Also this includes an extra build stage to copy the WASM files and their associated JS wrappers into the correct directory so they are served at the expected URIs for dynamic loading using importScripts.

To try this out locally still requires the use of

jupyter lite serve --LiteBuildConfig.extra_http_headers=Cross-Origin-Embedder-Policy=require-corp --LiteBuildConfig.extra_http_headers=Cross-Origin-Opener-Policy=same-origin

We still need some solution along these lines for the hosting of the demo site in github pages.

mountpoint: '/drive',
driveFsBaseUrl: options.baseUrl,
wasmBaseUrl:
options.baseUrl + 'extensions/@jupyterlite/terminal/static/wasm/',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This path is currently hardcoded and works OK for default installations. I am not sure if the extension path is configurable and if so, we'll need to obtain this dynamically at runtime.

@ianthomas23 ianthomas23 merged commit f730b65 into main Sep 12, 2024
8 checks passed
@ianthomas23 ianthomas23 deleted the remove-webworker branch September 12, 2024 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant