@thi.ng/fibers 1.0.65 → 1.0.67
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/README.md +1 -1
- package/fiber.js +3 -3
- package/ops.js +2 -2
- package/package.json +11 -11
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
[](https://mastodon.thi.ng/@toxi)
|
|
8
8
|
|
|
9
9
|
> [!NOTE]
|
|
10
|
-
> This is one of
|
|
10
|
+
> This is one of 211 standalone projects, maintained as part
|
|
11
11
|
> of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo
|
|
12
12
|
> and anti-framework.
|
|
13
13
|
>
|
package/fiber.js
CHANGED
|
@@ -279,7 +279,7 @@ let Fiber = class {
|
|
|
279
279
|
cancel() {
|
|
280
280
|
if (!this.isActive()) return;
|
|
281
281
|
this.logger?.debug("cancel", this.id);
|
|
282
|
-
for (
|
|
282
|
+
for (const child of this.children) child.cancel();
|
|
283
283
|
this.deinit();
|
|
284
284
|
this.state = STATE_CANCELED;
|
|
285
285
|
this.idgen?.free(this.id);
|
|
@@ -299,7 +299,7 @@ let Fiber = class {
|
|
|
299
299
|
if (!this.isActive()) return;
|
|
300
300
|
this.logger?.debug("done", this.id, value);
|
|
301
301
|
this.value = value;
|
|
302
|
-
for (
|
|
302
|
+
for (const child of this.children) child.done();
|
|
303
303
|
this.deinit();
|
|
304
304
|
this.state = STATE_DONE;
|
|
305
305
|
this.idgen?.free(this.id);
|
|
@@ -320,7 +320,7 @@ let Fiber = class {
|
|
|
320
320
|
catch(err) {
|
|
321
321
|
if (this.state >= STATE_ERROR || this.user?.catch?.(this, err)) return;
|
|
322
322
|
this.logger ? this.logger.severe(`error ${this.id}:`, err) : console.warn(`error ${this.id}:`, err);
|
|
323
|
-
for (
|
|
323
|
+
for (const child of this.children) child.cancel();
|
|
324
324
|
this.state = STATE_ERROR;
|
|
325
325
|
this.error = err;
|
|
326
326
|
this.deinit();
|
package/ops.js
CHANGED
|
@@ -16,7 +16,7 @@ function* waitFrames(delay) {
|
|
|
16
16
|
while (delay-- > 0) yield;
|
|
17
17
|
}
|
|
18
18
|
const sequence = (fibers, opts) => fiber(function* (ctx) {
|
|
19
|
-
for (
|
|
19
|
+
for (const fiber2 of fibers) {
|
|
20
20
|
const $fiber = ctx.fork(fiber2);
|
|
21
21
|
while ($fiber.isActive()) yield;
|
|
22
22
|
if ($fiber.state === STATE_ERROR) throw $fiber.error;
|
|
@@ -28,7 +28,7 @@ const sequence = (fibers, opts) => fiber(function* (ctx) {
|
|
|
28
28
|
const first = (fibers, opts) => fiber(function* (ctx) {
|
|
29
29
|
const $fibers = [...fibers].map((f) => ctx.fork(f));
|
|
30
30
|
while (true) {
|
|
31
|
-
for (
|
|
31
|
+
for (const f of $fibers) {
|
|
32
32
|
if (!f.isActive()) return f;
|
|
33
33
|
}
|
|
34
34
|
yield;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/fibers",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.67",
|
|
4
4
|
"description": "Process hierarchies & operators for cooperative multitasking",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -39,15 +39,15 @@
|
|
|
39
39
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@thi.ng/api": "^8.12.
|
|
43
|
-
"@thi.ng/arrays": "^2.14.
|
|
44
|
-
"@thi.ng/buffers": "^1.0.
|
|
45
|
-
"@thi.ng/checks": "^3.
|
|
46
|
-
"@thi.ng/errors": "^2.5.
|
|
47
|
-
"@thi.ng/idgen": "^2.2.
|
|
48
|
-
"@thi.ng/logger": "^3.2.
|
|
49
|
-
"@thi.ng/random": "^4.1.
|
|
50
|
-
"@thi.ng/timestamp": "^1.1.
|
|
42
|
+
"@thi.ng/api": "^8.12.10",
|
|
43
|
+
"@thi.ng/arrays": "^2.14.3",
|
|
44
|
+
"@thi.ng/buffers": "^1.0.29",
|
|
45
|
+
"@thi.ng/checks": "^3.8.0",
|
|
46
|
+
"@thi.ng/errors": "^2.5.50",
|
|
47
|
+
"@thi.ng/idgen": "^2.2.84",
|
|
48
|
+
"@thi.ng/logger": "^3.2.9",
|
|
49
|
+
"@thi.ng/random": "^4.1.35",
|
|
50
|
+
"@thi.ng/timestamp": "^1.1.29"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"esbuild": "^0.27.0",
|
|
@@ -115,5 +115,5 @@
|
|
|
115
115
|
"status": "alpha",
|
|
116
116
|
"year": 2023
|
|
117
117
|
},
|
|
118
|
-
"gitHead": "
|
|
118
|
+
"gitHead": "824bf9047b5a10f777c5c5b4aeecf0c750a22c75\n"
|
|
119
119
|
}
|