greybel-interpreter 4.9.0 → 4.9.1

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/dist/vm.js CHANGED
@@ -25,7 +25,7 @@ const evaluation_1 = require("./vm/evaluation");
25
25
  const number_1 = require("./types/number");
26
26
  const map_1 = require("./types/map");
27
27
  const list_1 = require("./types/list");
28
- const run_next_1 = require("./utils/run-next");
28
+ const non_blocking_schedule_1 = require("non-blocking-schedule");
29
29
  const string_1 = require("./types/string");
30
30
  const events_1 = __importDefault(require("events"));
31
31
  const object_value_1 = require("./utils/object-value");
@@ -65,7 +65,7 @@ class Debugger {
65
65
  resolve();
66
66
  }
67
67
  else {
68
- (0, run_next_1.runNext)(check);
68
+ (0, non_blocking_schedule_1.schedule)(check);
69
69
  }
70
70
  };
71
71
  check();
@@ -699,7 +699,7 @@ class VM {
699
699
  }
700
700
  if (this.actionCount++ === this.maxActionsPerLoop) {
701
701
  this.actionCount = 0;
702
- (0, run_next_1.runNext)(() => {
702
+ (0, non_blocking_schedule_1.schedule)(() => {
703
703
  this.resume(done);
704
704
  });
705
705
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "greybel-interpreter",
3
- "version": "4.9.0",
3
+ "version": "4.9.1",
4
4
  "description": "Interpreter",
5
5
  "main": "dist/index",
6
6
  "typings": "dist/index",
@@ -11,7 +11,8 @@
11
11
  "clean": "rm -rf dist",
12
12
  "test": "jest ./tests --testTimeout 10000",
13
13
  "lint": "eslint ./src/**/*.ts",
14
- "lint:fix": "eslint --fix ./src/**/*.ts"
14
+ "lint:fix": "eslint --fix ./src/**/*.ts",
15
+ "compile:browser": "rollup --config rollup.config.js --bundleConfigAsCjs"
15
16
  },
16
17
  "repository": {
17
18
  "type": "git",
@@ -28,7 +29,7 @@
28
29
  "homepage": "https://github.com/ayecue/greybel-interpreter#readme",
29
30
  "devDependencies": {
30
31
  "@types/jest": "^27.0.3",
31
- "@types/node": "^17.0.0",
32
+ "@types/node": "^20.14.11",
32
33
  "@types/uuid": "^8.3.3",
33
34
  "@typescript-eslint/eslint-plugin": "^5.62.0",
34
35
  "@typescript-eslint/parser": "^5.62.0",
@@ -49,7 +50,8 @@
49
50
  },
50
51
  "dependencies": {
51
52
  "greybel-core": "~1.7.0",
52
- "hyperid": "^3.2.0"
53
+ "hyperid": "^3.2.0",
54
+ "non-blocking-schedule": "^0.1.0"
53
55
  },
54
56
  "keywords": [
55
57
  "miniscript"
@@ -1 +0,0 @@
1
- export declare const runNext: any;
@@ -1,46 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.runNext = void 0;
4
- class RunNextHelper {
5
- constructor() {
6
- this.stack = [];
7
- this.sleep = 0;
8
- this.timer = null;
9
- }
10
- shouldSleep() {
11
- if (this.stack.length > 0)
12
- return this.sleep = 0;
13
- if (this.sleep++ <= RunNextHelper.SLEEP_LIMIT)
14
- return;
15
- clearInterval(this.timer);
16
- this.timer = null;
17
- }
18
- ;
19
- tick() {
20
- const current = this.stack;
21
- this.stack = [];
22
- for (let i = 0; i < current.length; i++) {
23
- try {
24
- current[i]();
25
- }
26
- catch (err) { }
27
- }
28
- this.shouldSleep();
29
- }
30
- ;
31
- start() {
32
- if (this.timer !== null)
33
- return;
34
- this.sleep = 0;
35
- this.timer = setInterval(() => this.tick(), 0);
36
- }
37
- ;
38
- add(callback) {
39
- this.stack.push(callback);
40
- this.start();
41
- }
42
- ;
43
- }
44
- RunNextHelper.SLEEP_LIMIT = 1000;
45
- const helper = new RunNextHelper();
46
- exports.runNext = helper.add.bind(helper);