@thi.ng/rstream-csp 2.0.79 → 3.0.3

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/CHANGELOG.md CHANGED
@@ -3,7 +3,7 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [2.0.79](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-csp@2.0.78...@thi.ng/rstream-csp@2.0.79) (2021-08-22)
6
+ ## [3.0.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-csp@3.0.2...@thi.ng/rstream-csp@3.0.3) (2021-10-15)
7
7
 
8
8
  **Note:** Version bump only for package @thi.ng/rstream-csp
9
9
 
@@ -11,35 +11,75 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
11
11
 
12
12
 
13
13
 
14
- # [2.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-csp@1.0.33...@thi.ng/rstream-csp@2.0.0) (2019-11-30)
14
+ ## [3.0.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-csp@3.0.1...@thi.ng/rstream-csp@3.0.2) (2021-10-15)
15
15
 
16
- ### Code Refactoring
16
+ **Note:** Version bump only for package @thi.ng/rstream-csp
17
17
 
18
- * **rstream-csp:** use options object arg ([b39f4d0](https://github.com/thi-ng/umbrella/commit/b39f4d023fdb90d5ad095b2e50d76e69c2b50843))
19
18
 
20
- ### BREAKING CHANGES
21
19
 
22
- * **rstream-csp:** use options object arg for fromChannel()
23
20
 
24
- # [1.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-csp@0.1.125...@thi.ng/rstream-csp@1.0.0) (2019-01-21)
21
+
22
+ ## [3.0.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-csp@3.0.0...@thi.ng/rstream-csp@3.0.1) (2021-10-13)
23
+
24
+ **Note:** Version bump only for package @thi.ng/rstream-csp
25
+
26
+
27
+
28
+
29
+
30
+ # [3.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-csp@2.0.80...@thi.ng/rstream-csp@3.0.0) (2021-10-12)
31
+
25
32
 
26
33
  ### Build System
27
34
 
28
- * update package scripts, outputs, imports in remaining packages ([f912a84](https://github.com/thi-ng/umbrella/commit/f912a84))
35
+ * major update of ALL pkgs (export maps, ESM only) ([0d1d6ea](https://github.com/thi-ng/umbrella/commit/0d1d6ea9fab2a645d6c5f2bf2591459b939c09b6))
36
+
29
37
 
30
38
  ### BREAKING CHANGES
31
39
 
32
- * enable multi-outputs (ES6 modules, CJS, UMD)
40
+ * discontinue CommonJS & UMD versions
41
+
42
+ - only ESM modules will be published from now on
43
+ - CJS obsolete due to ESM support in recent versions of node:
44
+ - i.e. launch NodeJS via:
45
+ - `node --experimental-specifier-resolution=node --experimental-repl-await`
46
+ - in the node REPL use `await import(...)` instead of `require()`
47
+ - UMD obsolete due to widespread browser support for ESM
48
+
49
+ Also:
50
+ - normalize/restructure/reorg all package.json files
51
+ - cleanup all build scripts, remove obsolete
52
+ - switch from mocha to @thi.ng/testament for all tests
53
+
54
+
55
+
56
+
57
+
58
+
59
+ # [2.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-csp@1.0.33...@thi.ng/rstream-csp@2.0.0) (2019-11-30)
60
+
61
+ ### Code Refactoring
62
+
63
+ - **rstream-csp:** use options object arg ([b39f4d0](https://github.com/thi-ng/umbrella/commit/b39f4d023fdb90d5ad095b2e50d76e69c2b50843))
64
+
65
+ ### BREAKING CHANGES
66
+
67
+ - **rstream-csp:** use options object arg for fromChannel()
68
+
69
+ # [1.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-csp@0.1.125...@thi.ng/rstream-csp@1.0.0) (2019-01-21)
70
+
71
+ ### Build System
72
+
73
+ - update package scripts, outputs, imports in remaining packages ([f912a84](https://github.com/thi-ng/umbrella/commit/f912a84))
74
+
75
+ ### BREAKING CHANGES
33
76
 
34
- - build scripts now first build ES6 modules in package root, then call
35
- `scripts/bundle-module` to build minified CJS & UMD bundles in `/lib`
36
- - all imports MUST be updated to only refer to package level
37
- (not individual files anymore). tree shaking in user land will get rid of
38
- all unused imported symbols
77
+ - enable multi-outputs (ES6 modules, CJS, UMD)
78
+ - build scripts now first build ES6 modules in package root, then call `scripts/bundle-module` to build minified CJS & UMD bundles in `/lib`
79
+ - all imports MUST be updated to only refer to package level (not individual files anymore). tree shaking in user land will get rid of all unused imported symbols
39
80
 
40
- <a name="0.1.0"></a>
41
- # 0.1.0 (2018-01-28)
81
+ # 0.1.0 (2018-01-28)
42
82
 
43
- ### Features
83
+ ### Features
44
84
 
45
- * **rstream-csp:** add new package, remove CSP dep from rstream ([e37f6a1](https://github.com/thi-ng/umbrella/commit/e37f6a1))
85
+ - **rstream-csp:** add new package, remove CSP dep from rstream ([e37f6a1](https://github.com/thi-ng/umbrella/commit/e37f6a1))
package/README.md CHANGED
@@ -42,15 +42,24 @@ and synchronous stream subscriptions/transformations of
42
42
  yarn add @thi.ng/rstream-csp
43
43
  ```
44
44
 
45
+ ES module import:
46
+
45
47
  ```html
46
- // ES module
47
- <script type="module" src="https://unpkg.com/@thi.ng/rstream-csp?module" crossorigin></script>
48
+ <script type="module" src="https://cdn.skypack.dev/@thi.ng/rstream-csp"></script>
49
+ ```
50
+
51
+ [Skypack documentation](https://docs.skypack.dev/)
52
+
53
+ For Node.js REPL:
54
+
55
+ ```text
56
+ # with flag only for < v16
57
+ node --experimental-repl-await
48
58
 
49
- // UMD
50
- <script src="https://unpkg.com/@thi.ng/rstream-csp/lib/index.umd.js" crossorigin></script>
59
+ > const rstreamCsp = await import("@thi.ng/rstream-csp");
51
60
  ```
52
61
 
53
- Package sizes (gzipped, pre-treeshake): ESM: 251 bytes / CJS: 307 bytes / UMD: 422 bytes
62
+ Package sizes (gzipped, pre-treeshake): ESM: 268 bytes
54
63
 
55
64
  ## Dependencies
56
65
 
package/index.d.ts CHANGED
@@ -1,2 +1,21 @@
1
- export * from "./from/channel";
1
+ import type { Channel } from "@thi.ng/csp";
2
+ import type { CommonOpts } from "@thi.ng/rstream";
3
+ import { Stream } from "@thi.ng/rstream/stream";
4
+ export interface FromChannelOpts extends CommonOpts {
5
+ /**
6
+ * If true, the parent CSP channel will be closed when this stream
7
+ * closes.
8
+ *
9
+ * @defaultValue true
10
+ */
11
+ closeChannel: boolean;
12
+ }
13
+ /**
14
+ * Returns a stream of values received from given
15
+ * {@link @thi.ng/csp#Channel}.
16
+ *
17
+ * @param src -
18
+ * @param opts -
19
+ */
20
+ export declare const fromChannel: <T>(src: Channel<T>, opts?: Partial<FromChannelOpts> | undefined) => Stream<T>;
2
21
  //# sourceMappingURL=index.d.ts.map
package/index.js CHANGED
@@ -1 +1,32 @@
1
- export * from "./from/channel";
1
+ import { LOGGER } from "@thi.ng/rstream/logger";
2
+ import { Stream } from "@thi.ng/rstream/stream";
3
+ /**
4
+ * Returns a stream of values received from given
5
+ * {@link @thi.ng/csp#Channel}.
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);
32
+ };
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@thi.ng/rstream-csp",
3
- "version": "2.0.79",
3
+ "version": "3.0.3",
4
4
  "description": "@thi.ng/csp bridge module for @thi.ng/rstream",
5
+ "type": "module",
5
6
  "module": "./index.js",
6
- "main": "./lib/index.js",
7
- "umd:main": "./lib/index.umd.js",
8
7
  "typings": "./index.d.ts",
8
+ "sideEffects": false,
9
9
  "repository": {
10
10
  "type": "git",
11
11
  "url": "https://github.com/thi-ng/umbrella.git"
@@ -24,29 +24,22 @@
24
24
  "author": "Karsten Schmidt <k+npm@thi.ng>",
25
25
  "license": "Apache-2.0",
26
26
  "scripts": {
27
- "build": "yarn clean && yarn build:es6 && node ../../scripts/bundle-module",
28
- "build:release": "yarn clean && yarn build:es6 && node ../../scripts/bundle-module all",
29
- "build:es6": "tsc --declaration",
30
- "build:test": "rimraf build && tsc -p test/tsconfig.json",
31
- "build:check": "tsc --isolatedModules --noEmit",
32
- "test": "mocha test",
33
- "cover": "nyc mocha test && nyc report --reporter=lcov",
34
- "clean": "rimraf *.js *.d.ts *.map .nyc_output build coverage doc lib from",
35
- "doc:readme": "ts-node -P ../../tools/tsconfig.json ../../tools/src/readme.ts",
36
- "doc": "typedoc --excludePrivate --out doc --theme ../../tools/doc/typedoc-theme src/index.ts",
27
+ "build": "yarn clean && tsc --declaration",
28
+ "clean": "rimraf *.js *.d.ts *.map doc",
29
+ "doc": "typedoc --excludePrivate --excludeInternal --out doc src/index.ts",
37
30
  "doc:ae": "mkdir -p .ae/doc .ae/temp && node_modules/.bin/api-extractor run --local --verbose",
38
- "pub": "yarn build:release && yarn publish --access public"
31
+ "doc:readme": "yarn doc:stats && ../../scripts/node-esm ../../tools/src/readme.ts",
32
+ "doc:stats": "../../scripts/node-esm ../../tools/src/module-stats.ts",
33
+ "pub": "yarn build && yarn publish --access public",
34
+ "test": "testament test"
39
35
  },
40
36
  "dependencies": {
41
- "@thi.ng/csp": "^1.1.73",
42
- "@thi.ng/rstream": "^6.0.20"
37
+ "@thi.ng/csp": "^2.0.3",
38
+ "@thi.ng/rstream": "^7.0.3"
39
+ },
40
+ "devDependencies": {
41
+ "@thi.ng/testament": "^0.1.3"
43
42
  },
44
- "files": [
45
- "*.js",
46
- "*.d.ts",
47
- "lib",
48
- "from"
49
- ],
50
43
  "keywords": [
51
44
  "async",
52
45
  "csp",
@@ -58,7 +51,18 @@
58
51
  "publishConfig": {
59
52
  "access": "public"
60
53
  },
61
- "sideEffects": false,
54
+ "engines": {
55
+ "node": ">=12.7"
56
+ },
57
+ "files": [
58
+ "*.js",
59
+ "*.d.ts"
60
+ ],
61
+ "exports": {
62
+ ".": {
63
+ "import": "./index.js"
64
+ }
65
+ },
62
66
  "thi.ng": {
63
67
  "parent": "@thi.ng/rstream",
64
68
  "related": [
@@ -67,5 +71,5 @@
67
71
  ],
68
72
  "year": 2018
69
73
  },
70
- "gitHead": "8ead409ded4bf8dceb0f24a538ba5ca00d07108d"
74
+ "gitHead": "1fb38cac74d6c009d96855c28784a267a81badf1"
71
75
  }
package/from/channel.d.ts DELETED
@@ -1,21 +0,0 @@
1
- import type { Channel } from "@thi.ng/csp";
2
- import type { CommonOpts } from "@thi.ng/rstream";
3
- import { Stream } from "@thi.ng/rstream";
4
- export interface FromChannelOpts extends CommonOpts {
5
- /**
6
- * If true, the parent CSP channel will be closed when this stream
7
- * closes.
8
- *
9
- * @defaultValue true
10
- */
11
- closeChannel: boolean;
12
- }
13
- /**
14
- * Returns a stream of values received from given
15
- * {@link @thi.ng/csp#Channel}.
16
- *
17
- * @param src -
18
- * @param opts -
19
- */
20
- export declare const fromChannel: <T>(src: Channel<T>, opts?: Partial<FromChannelOpts> | undefined) => Stream<T>;
21
- //# sourceMappingURL=channel.d.ts.map
package/from/channel.js DELETED
@@ -1,31 +0,0 @@
1
- import { LOGGER, Stream } from "@thi.ng/rstream";
2
- /**
3
- * Returns a stream of values received from given
4
- * {@link @thi.ng/csp#Channel}.
5
- *
6
- * @param src -
7
- * @param opts -
8
- */
9
- export const fromChannel = (src, opts) => {
10
- opts = { id: `channel-${src.id}`, closeChannel: true, ...opts };
11
- return new Stream((stream) => {
12
- let isActive = true;
13
- (async () => {
14
- let x;
15
- while (((x = null), (x = await src.read())) !== undefined) {
16
- if (x === undefined || !isActive) {
17
- break;
18
- }
19
- stream.next(x);
20
- }
21
- stream.done();
22
- })();
23
- return () => {
24
- if (opts.closeChannel !== false) {
25
- src.close(true);
26
- LOGGER.info("closed channel", src.id);
27
- }
28
- isActive = false;
29
- };
30
- }, opts);
31
- };
package/lib/index.js DELETED
@@ -1,31 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var rstream = require('@thi.ng/rstream');
6
-
7
- const fromChannel = (src, opts) => {
8
- opts = { id: `channel-${src.id}`, closeChannel: true, ...opts };
9
- return new rstream.Stream((stream) => {
10
- let isActive = true;
11
- (async () => {
12
- let x;
13
- while (((x = null), (x = await src.read())) !== undefined) {
14
- if (x === undefined || !isActive) {
15
- break;
16
- }
17
- stream.next(x);
18
- }
19
- stream.done();
20
- })();
21
- return () => {
22
- if (opts.closeChannel !== false) {
23
- src.close(true);
24
- rstream.LOGGER.info("closed channel", src.id);
25
- }
26
- isActive = false;
27
- };
28
- }, opts);
29
- };
30
-
31
- exports.fromChannel = fromChannel;
package/lib/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../from/channel.js"],"sourcesContent":null,"names":["Stream","LOGGER"],"mappings":";;;;;;AAQY,MAAC,WAAW,GAAG,CAAC,GAAG,EAAE,IAAI,KAAK;AAC1C,IAAI,IAAI,GAAG,EAAE,EAAE,EAAE,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,CAAC;AACpE,IAAI,OAAO,IAAIA,cAAM,CAAC,CAAC,MAAM,KAAK;AAClC,QAAQ,IAAI,QAAQ,GAAG,IAAI,CAAC;AAC5B,QAAQ,CAAC,YAAY;AACrB,YAAY,IAAI,CAAC,CAAC;AAClB,YAAY,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,MAAM,SAAS,EAAE;AACvE,gBAAgB,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,QAAQ,EAAE;AAClD,oBAAoB,MAAM;AAC1B,iBAAiB;AACjB,gBAAgB,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAC/B,aAAa;AACb,YAAY,MAAM,CAAC,IAAI,EAAE,CAAC;AAC1B,SAAS,GAAG,CAAC;AACb,QAAQ,OAAO,MAAM;AACrB,YAAY,IAAI,IAAI,CAAC,YAAY,KAAK,KAAK,EAAE;AAC7C,gBAAgB,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAChC,gBAAgBC,cAAM,CAAC,IAAI,CAAC,gBAAgB,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;AACtD,aAAa;AACb,YAAY,QAAQ,GAAG,KAAK,CAAC;AAC7B,SAAS,CAAC;AACV,KAAK,EAAE,IAAI,CAAC,CAAC;AACb;;;;"}
package/lib/index.umd.js DELETED
@@ -1 +0,0 @@
1
- !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@thi.ng/rstream")):"function"==typeof define&&define.amd?define(["exports","@thi.ng/rstream"],n):n(((e="undefined"!=typeof globalThis?globalThis:e||self).thi=e.thi||{},e.thi.ng=e.thi.ng||{},e.thi.ng.rstreamCsp={}),e.thi.ng.rstream)}(this,(function(e,n){"use strict";e.fromChannel=(e,t)=>(t={id:`channel-${e.id}`,closeChannel:!0,...t},new n.Stream((i=>{let o=!0;return(async()=>{let n;for(;void 0!==(n=null,n=await e.read())&&void 0!==n&&o;)i.next(n);i.done()})(),()=>{!1!==t.closeChannel&&(e.close(!0),n.LOGGER.info("closed channel",e.id)),o=!1}}),t)),Object.defineProperty(e,"__esModule",{value:!0})}));
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.umd.js","sources":["../from/channel.js"],"sourcesContent":null,"names":["Stream","LOGGER"],"mappings":";;;;;;AAQY,UAAC,WAAW,GAAG,CAAC,GAAG,EAAE,IAAI,KAAK;IAC1C,IAAI,IAAI,GAAG,EAAE,EAAE,EAAE,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,CAAC;IACpE,IAAI,OAAO,IAAIA,cAAM,CAAC,CAAC,MAAM,KAAK;IAClC,QAAQ,IAAI,QAAQ,GAAG,IAAI,CAAC;IAC5B,QAAQ,CAAC,YAAY;IACrB,YAAY,IAAI,CAAC,CAAC;IAClB,YAAY,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,MAAM,SAAS,EAAE;IACvE,gBAAgB,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,QAAQ,EAAE;IAClD,oBAAoB,MAAM;IAC1B,iBAAiB;IACjB,gBAAgB,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC/B,aAAa;IACb,YAAY,MAAM,CAAC,IAAI,EAAE,CAAC;IAC1B,SAAS,GAAG,CAAC;IACb,QAAQ,OAAO,MAAM;IACrB,YAAY,IAAI,IAAI,CAAC,YAAY,KAAK,KAAK,EAAE;IAC7C,gBAAgB,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAChC,gBAAgBC,cAAM,CAAC,IAAI,CAAC,gBAAgB,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;IACtD,aAAa;IACb,YAAY,QAAQ,GAAG,KAAK,CAAC;IAC7B,SAAS,CAAC;IACV,KAAK,EAAE,IAAI,CAAC,CAAC;IACb;;;;;;;;;;"}