jupyterlite / cockle

In-browser bash-like shell implemented in TypeScript.
BSD 3-Clause "New" or "Revised" License
3 stars 2 forks source link

Obtain wasm packages from emscripten-forge when building deployment #61

Closed ianthomas23 closed 4 weeks ago

ianthomas23 commented 4 weeks ago

This PR changes the configuration and packaging of wasm command files to occur when building a deployment (static website) rather than being hard-coded in the cockle source code and the wasm files being packed in the NPM package. The process is similar to that performed for python xeus kernels in JupyterLite except that the code here is TypeScript rather than Python. There is an input JSON file config-cockle-base.json containing configuration for compulsory wasm packages (cockle_fs, coreutils and grep) which ships with cockle, and this can be added with an extra config file to add optional wasm packages such as lua. A JSON config file is placed alongside the wasm files when a deployment is created, and ShellImpl reads this config file to configure the various WasmCommandRunner objects.

Probably lots of the internal details will change. The JSON file formats should be in schemas, and the prepare_wasm node tool script should be more robust. It would be simpler for end-users if instead of using a bespoke JSON file a normal micromamba environment file could be used (as with python xeus), but for this we would need some other way to also configure which emscripten-forge packages contain which wasm modules and which commands. These could probably be embedded in the emscripten-forge packages in some way.

After merging this will need a new cockle release before it can be tried out in JupyterLite.