@basthon/kernel-javascript 0.35.4 → 0.35.8

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/kernel.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { KernelBase } from '@basthon/kernel-base';
2
2
  export declare class KernelJavaScript extends KernelBase {
3
3
  private _context;
4
- constructor();
4
+ constructor(rootPath: string);
5
5
  language(): string;
6
6
  languageName(): string;
7
7
  moduleExts(): string[];
package/lib/kernel.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { KernelBase } from '@basthon/kernel-base';
2
2
  export class KernelJavaScript extends KernelBase {
3
- constructor() {
4
- super();
3
+ constructor(rootPath) {
4
+ super(rootPath);
5
5
  this._context = {
6
6
  Basthon: undefined,
7
7
  Jupyter: undefined,
@@ -22,7 +22,7 @@ export class KernelJavaScript extends KernelBase {
22
22
  eval(code) {
23
23
  try {
24
24
  // using context to hide several global variables
25
- return window.eval(`with(Basthon.context) { ${code} }`);
25
+ return window.eval(`with(Basthon._context) { ${code} }`);
26
26
  }
27
27
  catch (e) {
28
28
  if (e instanceof SyntaxError)
@@ -41,13 +41,12 @@ export class KernelJavaScript extends KernelBase {
41
41
  console.error = errCallback;
42
42
  this.execution_count++;
43
43
  // evaluation
44
- let result;
44
+ let result = undefined;
45
45
  try {
46
46
  result = this.eval(code);
47
47
  }
48
48
  catch (e) {
49
- if ((e === null || e === void 0 ? void 0 : e.message) != null)
50
- console.error(e.message);
49
+ console.error(`Uncaught ${e.name || ""}: ${e === null || e === void 0 ? void 0 : e.message}`);
51
50
  }
52
51
  // restoration
53
52
  console.log = console_log;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@basthon/kernel-javascript",
3
- "version": "0.35.4",
3
+ "version": "0.35.8",
4
4
  "description": "Basthon - JavaScript Kernel",
5
5
  "homepage": "https://basthon.fr",
6
6
  "bugs": {
@@ -25,7 +25,7 @@
25
25
  "clean": "rm -rf lib/"
26
26
  },
27
27
  "dependencies": {
28
- "@basthon/kernel-base": "^0.35.4"
28
+ "@basthon/kernel-base": "^0.35.8"
29
29
  },
30
30
  "devDependencies": {
31
31
  "gulp": "^4.0.2",
@@ -35,5 +35,5 @@
35
35
  "publishConfig": {
36
36
  "access": "public"
37
37
  },
38
- "gitHead": "ebf66dd4f601ad1b975d2e82b384b47a07ae4255"
38
+ "gitHead": "81d8ed255bdf30248c9c6ad761b5a820386f5e91"
39
39
  }