@jupyterlite/kernel 0.6.0-alpha.5 → 0.6.0-alpha.6

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.
@@ -1,4 +1,5 @@
1
1
  import { KernelSpec } from '@jupyterlab/services';
2
+ import { ISignal } from '@lumino/signaling';
2
3
  import { IKernel, IKernelSpecs } from './tokens';
3
4
  /**
4
5
  * A class to register in-browser kernel specs.
@@ -16,6 +17,10 @@ export declare class KernelSpecs implements IKernelSpecs {
16
17
  * Get the kernel factories for the current kernels.
17
18
  */
18
19
  get factories(): KernelSpecs.KernelFactories;
20
+ /**
21
+ * Signal emitted when the specs change.
22
+ */
23
+ get changed(): ISignal<IKernelSpecs, KernelSpec.ISpecModels | null>;
19
24
  /**
20
25
  * Register a new kernel.
21
26
  *
@@ -24,6 +29,7 @@ export declare class KernelSpecs implements IKernelSpecs {
24
29
  register(options: KernelSpecs.IKernelOptions): void;
25
30
  private _specs;
26
31
  private _factories;
32
+ private _changed;
27
33
  }
28
34
  /**
29
35
  * A namespace for KernelSpecs statics.
@@ -1,4 +1,5 @@
1
1
  import { PageConfig } from '@jupyterlab/coreutils';
2
+ import { Signal } from '@lumino/signaling';
2
3
  import { FALLBACK_KERNEL } from './tokens';
3
4
  /**
4
5
  * A class to register in-browser kernel specs.
@@ -7,6 +8,7 @@ export class KernelSpecs {
7
8
  constructor() {
8
9
  this._specs = new Map();
9
10
  this._factories = new Map();
11
+ this._changed = new Signal(this);
10
12
  }
11
13
  /**
12
14
  * Get the kernel specs.
@@ -38,6 +40,12 @@ export class KernelSpecs {
38
40
  get factories() {
39
41
  return this._factories;
40
42
  }
43
+ /**
44
+ * Signal emitted when the specs change.
45
+ */
46
+ get changed() {
47
+ return this._changed;
48
+ }
41
49
  /**
42
50
  * Register a new kernel.
43
51
  *
@@ -47,6 +55,8 @@ export class KernelSpecs {
47
55
  const { spec, create } = options;
48
56
  this._specs.set(spec.name, spec);
49
57
  this._factories.set(spec.name, create);
58
+ // notify a new spec has been added
59
+ this._changed.emit(this.specs);
50
60
  }
51
61
  }
52
62
  //# sourceMappingURL=kernelspecs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"kernelspecs.js","sourceRoot":"","sources":["../src/kernelspecs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAInD,OAAO,EAAyB,eAAe,EAAE,MAAM,UAAU,CAAC;AAElE;;GAEG;AACH,MAAM,OAAO,WAAW;IAAxB;QAgDU,WAAM,GAAG,IAAI,GAAG,EAAiC,CAAC;QAClD,eAAU,GAAG,IAAI,GAAG,EAAqC,CAAC;IACpE,CAAC;IAjDC;;OAEG;IACH,IAAI,KAAK;QACP,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,EAAE;YAC1B,OAAO,IAAI,CAAC;SACb;QAED,OAAO;YACL,OAAO,EAAE,IAAI,CAAC,iBAAiB;YAC/B,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC;SAC7C,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,IAAI,iBAAiB;QACnB,IAAI,iBAAiB,GAAG,UAAU,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;QAElE,IAAI,CAAC,iBAAiB,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE;YAC1C,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;YAC5C,IAAI,CAAC,IAAI,EAAE,CAAC;YACZ,iBAAiB,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;SAC7B;QAED,OAAO,iBAAiB,IAAI,eAAe,CAAC;IAC9C,CAAC;IAED;;OAEG;IACH,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED;;;;OAIG;IACH,QAAQ,CAAC,OAAmC;QAC1C,MAAM,EA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,iBAAiB,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;SAC7B;QAED,OAAO,iBAAiB,IAAI,eAAe,CAAC;IAC9C,CAAC;IAED;;OAEG;IACH,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED;;;;OAIG;IACH,QAAQ,CAAC,OAAmC;QAC1C,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;QACjC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACjC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAEvC,mCAAmC;QACnC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;CAKF"}
package/lib/tokens.d.ts CHANGED
@@ -112,6 +112,10 @@ export interface IKernelSpecs {
112
112
  * Get the kernel factories for the current kernels.
113
113
  */
114
114
  readonly factories: KernelSpecs.KernelFactories;
115
+ /**
116
+ * Signal emitted when the specs change.
117
+ */
118
+ readonly changed: ISignal<IKernelSpecs, KernelSpec.ISpecModels | null>;
115
119
  /**
116
120
  * Register a new kernel spec
117
121
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jupyterlite/kernel",
3
- "version": "0.6.0-alpha.5",
3
+ "version": "0.6.0-alpha.6",
4
4
  "description": "JupyterLite - Kernel",
5
5
  "homepage": "https://github.com/jupyterlite/jupyterlite",
6
6
  "bugs": {
@@ -43,9 +43,9 @@
43
43
  "watch": "tsc -b --watch"
44
44
  },
45
45
  "dependencies": {
46
- "@jupyterlab/coreutils": "~6.4.0-beta.2",
47
- "@jupyterlab/observables": "~5.4.0-beta.2",
48
- "@jupyterlab/services": "~7.4.0-beta.2",
46
+ "@jupyterlab/coreutils": "~6.4.0-rc.0",
47
+ "@jupyterlab/observables": "~5.4.0-rc.0",
48
+ "@jupyterlab/services": "~7.4.0-rc.0",
49
49
  "@lumino/coreutils": "^2.2.0",
50
50
  "@lumino/disposable": "^2.1.3",
51
51
  "@lumino/signaling": "^2.1.3",
@@ -56,7 +56,7 @@
56
56
  "devDependencies": {
57
57
  "@babel/core": "^7.11.6",
58
58
  "@babel/preset-env": "^7.12.1",
59
- "@jupyterlab/testutils": "~4.4.0-beta.2",
59
+ "@jupyterlab/testutils": "~4.4.0-rc.0",
60
60
  "@types/jest": "^29.5.3",
61
61
  "jest": "^29.6.2",
62
62
  "rimraf": "~5.0.1",
@@ -2,7 +2,9 @@ import { PageConfig } from '@jupyterlab/coreutils';
2
2
 
3
3
  import { KernelSpec } from '@jupyterlab/services';
4
4
 
5
- import { IKernel, IKernelSpecs, FALLBACK_KERNEL } from './tokens';
5
+ import { ISignal, Signal } from '@lumino/signaling';
6
+
7
+ import { FALLBACK_KERNEL, IKernel, IKernelSpecs } from './tokens';
6
8
 
7
9
  /**
8
10
  * A class to register in-browser kernel specs.
@@ -44,6 +46,13 @@ export class KernelSpecs implements IKernelSpecs {
44
46
  return this._factories;
45
47
  }
46
48
 
49
+ /**
50
+ * Signal emitted when the specs change.
51
+ */
52
+ get changed(): ISignal<IKernelSpecs, KernelSpec.ISpecModels | null> {
53
+ return this._changed;
54
+ }
55
+
47
56
  /**
48
57
  * Register a new kernel.
49
58
  *
@@ -53,10 +62,14 @@ export class KernelSpecs implements IKernelSpecs {
53
62
  const { spec, create } = options;
54
63
  this._specs.set(spec.name, spec);
55
64
  this._factories.set(spec.name, create);
65
+
66
+ // notify a new spec has been added
67
+ this._changed.emit(this.specs);
56
68
  }
57
69
 
58
70
  private _specs = new Map<string, KernelSpec.ISpecModel>();
59
71
  private _factories = new Map<string, KernelSpecs.KernelFactory>();
72
+ private _changed = new Signal<this, KernelSpec.ISpecModels | null>(this);
60
73
  }
61
74
 
62
75
  /**
package/src/tokens.ts CHANGED
@@ -145,6 +145,11 @@ export interface IKernelSpecs {
145
145
  */
146
146
  readonly factories: KernelSpecs.KernelFactories;
147
147
 
148
+ /**
149
+ * Signal emitted when the specs change.
150
+ */
151
+ readonly changed: ISignal<IKernelSpecs, KernelSpec.ISpecModels | null>;
152
+
148
153
  /**
149
154
  * Register a new kernel spec
150
155
  *