@jupyterlite/xeus 3.0.0-a2 → 3.0.0

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/lib/worker.js CHANGED
@@ -87,12 +87,24 @@ export class XeusRemoteKernel {
87
87
  // location of the kernel binary on the server
88
88
  const binary_js = URLExt.join(baseUrl, kernelSpec.argv[0]);
89
89
  const binary_wasm = binary_js.replace('.js', '.wasm');
90
+ const binary_data = binary_js.replace('.js', '.data');
91
+ const kernel_root_url = URLExt.join(baseUrl, 'xeus', 'kernels', kernelSpec.dir);
92
+ const sharedLibs = kernelSpec.metadata && kernelSpec.metadata.shared
93
+ ? kernelSpec.metadata.shared
94
+ : {};
90
95
  importScripts(binary_js);
91
96
  globalThis.Module = await createXeusModule({
92
97
  locateFile: (file) => {
98
+ if (file in sharedLibs) {
99
+ return URLExt.join(kernel_root_url, file);
100
+ }
93
101
  if (file.endsWith('.wasm')) {
94
102
  return binary_wasm;
95
103
  }
104
+ else if (file.endsWith('.data')) {
105
+ // Handle the .data file if it exists
106
+ return binary_data;
107
+ }
96
108
  return file;
97
109
  }
98
110
  });
@@ -100,22 +112,12 @@ export class XeusRemoteKernel {
100
112
  await waitRunDependency();
101
113
  if (globalThis.Module.FS !== undefined &&
102
114
  globalThis.Module.loadDynamicLibrary !== undefined) {
103
- const kernel_root_url = empackEnvMetaLink
104
- ? empackEnvMetaLink
105
- : URLExt.join(baseUrl, `xeus/kernels/${kernelSpec.dir}`);
115
+ const empackEnvMetaLocation = empackEnvMetaLink || kernel_root_url;
106
116
  const verbose = true;
107
- const packagesJsonUrl = `${kernel_root_url}/empack_env_meta.json`;
117
+ const packagesJsonUrl = `${empackEnvMetaLocation}/empack_env_meta.json`;
108
118
  const pkgRootUrl = URLExt.join(baseUrl, 'xeus/kernel_packages');
109
- let packageData = {};
110
- packageData = await bootstrapFromEmpackPackedEnvironment(packagesJsonUrl, verbose, false, globalThis.Module, pkgRootUrl);
111
- if (kernelSpec.name === 'xpython') {
112
- if (Object.keys(packageData).length) {
113
- const { pythonVersion, prefix } = packageData;
114
- if (pythonVersion) {
115
- globalThis.Module.init_phase_2(prefix, pythonVersion, verbose);
116
- }
117
- }
118
- }
119
+ const bootstrapPython = kernelSpec.name === 'xpython';
120
+ await bootstrapFromEmpackPackedEnvironment(packagesJsonUrl, verbose, false, globalThis.Module, pkgRootUrl, bootstrapPython);
119
121
  }
120
122
  await waitRunDependency();
121
123
  rawXKernel = new globalThis.Module.xkernel();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupyterlite/xeus",
3
- "version": "3.0.0-a2",
3
+ "version": "3.0.0",
4
4
  "description": "JupyterLite Xeus kernels",
5
5
  "keywords": [
6
6
  "jupyter",
@@ -36,7 +36,7 @@
36
36
  "watch:src": "tsc -w --sourceMap"
37
37
  },
38
38
  "dependencies": {
39
- "@emscripten-forge/mambajs": "^0.1.0",
39
+ "@emscripten-forge/mambajs": "^0.2.0",
40
40
  "@jupyterlab/coreutils": "^6",
41
41
  "@jupyterlab/services": "~7.2.5",
42
42
  "@jupyterlite/contents": "^0.2.0 || ^0.3.0 || ^0.4.5",