@thi.ng/rstream-csp 3.1.84 → 3.1.86

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.
Files changed (3) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/index.js +25 -29
  3. package/package.json +8 -6
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2023-12-03T12:13:31Z
3
+ - **Last updated**: 2023-12-11T10:07:09Z
4
4
  - **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
5
5
 
6
6
  All notable changes to this project will be documented in this file.
package/index.js CHANGED
@@ -1,32 +1,28 @@
1
1
  import { LOGGER } from "@thi.ng/rstream/logger";
2
2
  import { Stream } from "@thi.ng/rstream/stream";
3
- /**
4
- * Returns a stream of values received from given
5
- * [`Channel`](https://docs.thi.ng/umbrella/csp/classes/Channel.html).
6
- *
7
- * @param src -
8
- * @param opts -
9
- */
10
- export const fromChannel = (src, opts) => {
11
- opts = { id: `channel-${src.id}`, closeChannel: true, ...opts };
12
- return new Stream((stream) => {
13
- let isActive = true;
14
- (async () => {
15
- let x;
16
- while (((x = null), (x = await src.read())) !== undefined) {
17
- if (x === undefined || !isActive) {
18
- break;
19
- }
20
- stream.next(x);
21
- }
22
- stream.done();
23
- })();
24
- return () => {
25
- if (opts.closeChannel !== false) {
26
- src.close(true);
27
- LOGGER.info("closed channel", src.id);
28
- }
29
- isActive = false;
30
- };
31
- }, opts);
3
+ const fromChannel = (src, opts) => {
4
+ opts = { id: `channel-${src.id}`, closeChannel: true, ...opts };
5
+ return new Stream((stream) => {
6
+ let isActive = true;
7
+ (async () => {
8
+ let x;
9
+ while ((x = null, x = await src.read()) !== void 0) {
10
+ if (x === void 0 || !isActive) {
11
+ break;
12
+ }
13
+ stream.next(x);
14
+ }
15
+ stream.done();
16
+ })();
17
+ return () => {
18
+ if (opts.closeChannel !== false) {
19
+ src.close(true);
20
+ LOGGER.info("closed channel", src.id);
21
+ }
22
+ isActive = false;
23
+ };
24
+ }, opts);
25
+ };
26
+ export {
27
+ fromChannel
32
28
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/rstream-csp",
3
- "version": "3.1.84",
3
+ "version": "3.1.86",
4
4
  "description": "@thi.ng/csp bridge module for @thi.ng/rstream",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -24,7 +24,9 @@
24
24
  "author": "Karsten Schmidt (https://thi.ng)",
25
25
  "license": "Apache-2.0",
26
26
  "scripts": {
27
- "build": "yarn clean && tsc --declaration",
27
+ "build": "yarn build:esbuild && yarn build:decl",
28
+ "build:decl": "tsc --declaration --emitDeclarationOnly",
29
+ "build:esbuild": "esbuild --format=esm --platform=neutral --target=es2022 --tsconfig=tsconfig.json --outdir=. src/**/*.ts",
28
30
  "clean": "rimraf --glob '*.js' '*.d.ts' '*.map' doc",
29
31
  "doc": "typedoc --excludePrivate --excludeInternal --out doc src/index.ts",
30
32
  "doc:ae": "mkdir -p .ae/doc .ae/temp && api-extractor run --local --verbose",
@@ -33,12 +35,12 @@
33
35
  "test": "bun test"
34
36
  },
35
37
  "dependencies": {
36
- "@thi.ng/csp": "^2.1.80",
37
- "@thi.ng/rstream": "^8.2.12"
38
+ "@thi.ng/csp": "^2.1.82",
39
+ "@thi.ng/rstream": "^8.2.14"
38
40
  },
39
41
  "devDependencies": {
40
42
  "@microsoft/api-extractor": "^7.38.3",
41
- "@thi.ng/testament": "^0.4.3",
43
+ "esbuild": "^0.19.8",
42
44
  "rimraf": "^5.0.5",
43
45
  "tools": "^0.0.1",
44
46
  "typedoc": "^0.25.4",
@@ -75,5 +77,5 @@
75
77
  ],
76
78
  "year": 2018
77
79
  },
78
- "gitHead": "04d1de79f256d7a53c6b5fd157b37f49bc88e11d\n"
80
+ "gitHead": "5e7bafedfc3d53bc131469a28de31dd8e5b4a3ff\n"
79
81
  }