@jupyterlite/xeus 3.0.0-a0 → 3.0.0-a2

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
@@ -2,6 +2,7 @@
2
2
  // Copyright (c) JupyterLite Contributors
3
3
  // Distributed under the terms of the Modified BSD License.
4
4
  import { URLExt } from '@jupyterlab/coreutils';
5
+ import { bootstrapFromEmpackPackedEnvironment } from '@emscripten-forge/mambajs';
5
6
  globalThis.Module = {};
6
7
  // when a toplevel cell uses an await, the cell is implicitly
7
8
  // wrapped in a async function. Since the webloop - eventloop
@@ -97,17 +98,24 @@ export class XeusRemoteKernel {
97
98
  });
98
99
  try {
99
100
  await waitRunDependency();
100
- // each kernel can have a `async_init` function
101
- // which can do kernel specific **async** initialization
102
- // This function is usually implemented in the pre/post.js
103
- // in the emscripten build of that kernel
104
- if (globalThis.Module['async_init'] !== undefined) {
101
+ if (globalThis.Module.FS !== undefined &&
102
+ globalThis.Module.loadDynamicLibrary !== undefined) {
105
103
  const kernel_root_url = empackEnvMetaLink
106
104
  ? empackEnvMetaLink
107
105
  : URLExt.join(baseUrl, `xeus/kernels/${kernelSpec.dir}`);
108
- const pkg_root_url = URLExt.join(baseUrl, 'xeus/kernel_packages');
109
106
  const verbose = true;
110
- await globalThis.Module['async_init'](kernel_root_url, pkg_root_url, verbose);
107
+ const packagesJsonUrl = `${kernel_root_url}/empack_env_meta.json`;
108
+ 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
+ }
111
119
  }
112
120
  await waitRunDependency();
113
121
  rawXKernel = new globalThis.Module.xkernel();
@@ -120,11 +128,9 @@ export class XeusRemoteKernel {
120
128
  catch (e) {
121
129
  if (typeof e === 'number') {
122
130
  const msg = globalThis.Module.get_exception_message(e);
123
- console.error(msg);
124
131
  throw new Error(msg);
125
132
  }
126
133
  else {
127
- console.error(e);
128
134
  throw e;
129
135
  }
130
136
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupyterlite/xeus",
3
- "version": "3.0.0-a0",
3
+ "version": "3.0.0-a2",
4
4
  "description": "JupyterLite Xeus kernels",
5
5
  "keywords": [
6
6
  "jupyter",
@@ -36,11 +36,12 @@
36
36
  "watch:src": "tsc -w --sourceMap"
37
37
  },
38
38
  "dependencies": {
39
+ "@emscripten-forge/mambajs": "^0.1.0",
39
40
  "@jupyterlab/coreutils": "^6",
40
- "@jupyterlab/services": "^7",
41
- "@jupyterlite/contents": "^0.2.0 || ^0.3.0 || ^0.4.0",
42
- "@jupyterlite/kernel": "^0.2.0 || ^0.3.0 || ^0.4.0",
43
- "@jupyterlite/server": "^0.2.0 || ^0.3.0 || ^0.4.0",
41
+ "@jupyterlab/services": "~7.2.5",
42
+ "@jupyterlite/contents": "^0.2.0 || ^0.3.0 || ^0.4.5",
43
+ "@jupyterlite/kernel": "^0.2.0 || ^0.3.0 || ^0.4.5",
44
+ "@jupyterlite/server": "^0.2.0 || ^0.3.0 || ^0.4.5",
44
45
  "@lumino/coreutils": "^2",
45
46
  "@lumino/signaling": "^2",
46
47
  "coincident": "^1.2.3",