From f912a84acddcacd415b1af71b9b1b81ada5d4e49 Mon Sep 17 00:00:00 2001 From: Karsten Schmidt Date: Tue, 8 Jan 2019 10:17:39 +0000 Subject: [PATCH] build: update package scripts, outputs, imports in remaining packages BREAKING CHANGE: enable multi-outputs (ES6 modules, CJS, UMD) - build scripts now first build ES6 modules in package root, then call `scripts/bundle-module` to build minified CJS & UMD bundles in `/lib` - 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 --- packages/hdom-canvas/package.json | 17 +++++--- packages/hdom-canvas/src/index.ts | 17 ++++---- packages/hdom-canvas/test/tsconfig.json | 3 +- packages/hdom-components/package.json | 17 +++++--- packages/hdom-components/src/button-group.ts | 5 +-- packages/hdom-components/src/button.ts | 2 +- packages/hdom-components/src/fps-counter.ts | 4 +- packages/hdom-components/src/link.ts | 2 +- packages/hdom-components/src/notification.ts | 2 +- packages/hdom-components/src/pager.ts | 3 +- packages/hdom-components/src/sparkline.ts | 5 +-- packages/hdom-components/test/tsconfig.json | 3 +- packages/hdom-mock/package.json | 20 ++++++---- packages/hdom-mock/src/index.ts | 16 +++++--- packages/hdom-mock/test/tsconfig.json | 3 +- packages/hdom/package.json | 22 +++++++--- packages/hdom/src/api.ts | 2 +- packages/hdom/src/diff.ts | 6 +-- packages/hdom/src/dom.ts | 11 +++-- packages/hdom/src/index.ts | 2 + packages/hdom/src/normalize.ts | 14 +++---- packages/hdom/src/render-once.ts | 2 +- packages/hdom/src/start.ts | 2 +- packages/hdom/src/utils.ts | 2 +- packages/hdom/test/index.ts | 19 ++++----- packages/hdom/test/tsconfig.json | 3 +- packages/rstream-csp/package.json | 17 +++++--- packages/rstream-csp/src/from/channel.ts | 7 ++-- packages/rstream-csp/test/tsconfig.json | 3 +- packages/rstream-csp/tsconfig.json | 2 +- packages/rstream-dot/package.json | 17 +++++--- packages/rstream-dot/src/index.ts | 10 +++-- packages/rstream-dot/test/tsconfig.json | 3 +- packages/rstream-gestures/package.json | 17 +++++--- packages/rstream-gestures/src/index.ts | 7 ++-- packages/rstream-gestures/test/tsconfig.json | 3 +- packages/rstream-graph/package.json | 18 ++++++--- packages/rstream-graph/src/api.ts | 6 +-- packages/rstream-graph/src/graph.ts | 24 +++++------ packages/rstream-graph/src/nodes/extract.ts | 3 +- packages/rstream-graph/src/nodes/math.ts | 5 +-- packages/rstream-graph/test/index.ts | 3 +- packages/rstream-graph/test/tsconfig.json | 3 +- packages/rstream-log/package.json | 17 +++++--- packages/rstream-log/src/api.ts | 4 +- packages/rstream-log/src/logger.ts | 7 +--- packages/rstream-log/src/output/console.ts | 2 +- packages/rstream-log/src/output/file.ts | 6 +-- packages/rstream-log/src/xform/filter.ts | 7 ++-- packages/rstream-log/src/xform/format.ts | 3 +- packages/rstream-log/test/tsconfig.json | 3 +- packages/rstream-query/package.json | 17 +++++--- packages/rstream-query/src/api.ts | 4 +- packages/rstream-query/src/convert.ts | 7 +--- packages/rstream-query/src/pattern.ts | 3 +- packages/rstream-query/src/qvar.ts | 2 +- packages/rstream-query/src/store.ts | 40 ++++++++++--------- packages/rstream-query/test/tsconfig.json | 3 +- packages/rstream/package.json | 17 +++++--- packages/rstream/src/api.ts | 5 +-- packages/rstream/src/from/atom.ts | 4 +- packages/rstream/src/from/promises.ts | 3 +- packages/rstream/src/from/raf.ts | 2 +- packages/rstream/src/from/view.ts | 6 +-- packages/rstream/src/index.ts | 1 + packages/rstream/src/pubsub.ts | 8 ++-- packages/rstream/src/stream-merge.ts | 4 +- packages/rstream/src/stream-sync.ts | 16 ++++---- packages/rstream/src/stream.ts | 6 +-- packages/rstream/src/subs/bisect.ts | 3 +- packages/rstream/src/subs/post-worker.ts | 5 +-- packages/rstream/src/subs/resolve.ts | 2 +- .../rstream/src/subs/sidechain-partition.ts | 2 +- packages/rstream/src/subs/sidechain-toggle.ts | 2 +- packages/rstream/src/subs/transduce.ts | 5 +-- packages/rstream/src/subscription.ts | 21 +++++----- packages/rstream/src/utils/worker.ts | 6 +-- packages/rstream/test/tsconfig.json | 3 +- packages/transducers-hdom/package.json | 19 +++++---- packages/transducers-hdom/src/index.ts | 14 ++++--- scripts/bundle-module | 16 ++++---- 81 files changed, 347 insertions(+), 300 deletions(-) diff --git a/packages/hdom-canvas/package.json b/packages/hdom-canvas/package.json index acc3c113d7..505d1a67f5 100644 --- a/packages/hdom-canvas/package.json +++ b/packages/hdom-canvas/package.json @@ -2,7 +2,9 @@ "name": "@thi.ng/hdom-canvas", "version": "0.1.20", "description": "Declarative canvas scenegraph & visualization for @thi.ng/hdom", - "main": "./index.js", + "module": "./index.js", + "main": "./lib/index.js", + "umd:main": "./lib/index.umd.js", "typings": "./index.d.ts", "repository": { "type": "git", @@ -12,12 +14,14 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "build": "yarn clean && tsc --declaration", - "clean": "rimraf *.js *.d.ts .nyc_output build coverage doc", + "build": "yarn clean && yarn build:es6 && yarn build:bundle", + "build:es6": "tsc --declaration", + "build:bundle": "../../scripts/bundle-module hdomCanvas api checks diff hdom", + "test": "rimraf build && tsc -p test/tsconfig.json && nyc mocha build/test/*.js", + "clean": "rimraf *.js *.d.ts .nyc_output build coverage doc lib", "cover": "yarn test && nyc report --reporter=lcov", "doc": "node_modules/.bin/typedoc --mode modules --out doc src", - "pub": "yarn build && yarn publish --access public", - "test": "rimraf build && tsc -p test && nyc mocha build/test/*.js" + "pub": "yarn build && yarn publish --access public" }, "devDependencies": { "@types/mocha": "^5.2.5", @@ -46,5 +50,6 @@ ], "publishConfig": { "access": "public" - } + }, + "sideEffects": false } \ No newline at end of file diff --git a/packages/hdom-canvas/src/index.ts b/packages/hdom-canvas/src/index.ts index 30f88e22eb..3be1838b54 100644 --- a/packages/hdom-canvas/src/index.ts +++ b/packages/hdom-canvas/src/index.ts @@ -1,11 +1,12 @@ -import { IObjectOf } from "@thi.ng/api/api"; -import { isArray } from "@thi.ng/checks/is-array"; -import { isArrayLike } from "@thi.ng/checks/is-arraylike"; -import { isNotStringAndIterable } from "@thi.ng/checks/is-not-string-iterable"; -import { DiffMode } from "@thi.ng/diff/api"; -import { diffArray } from "@thi.ng/diff/array"; -import { HDOMImplementation, HDOMOpts } from "@thi.ng/hdom/api"; -import { equiv, releaseTree } from "@thi.ng/hdom/diff"; +import { IObjectOf } from "@thi.ng/api"; +import { isArray, isArrayLike, isNotStringAndIterable } from "@thi.ng/checks"; +import { diffArray, DiffMode } from "@thi.ng/diff"; +import { + equiv, + HDOMImplementation, + HDOMOpts, + releaseTree +} from "@thi.ng/hdom"; interface DrawState { attribs: IObjectOf; diff --git a/packages/hdom-canvas/test/tsconfig.json b/packages/hdom-canvas/test/tsconfig.json index c93bb84899..2c9c12a650 100644 --- a/packages/hdom-canvas/test/tsconfig.json +++ b/packages/hdom-canvas/test/tsconfig.json @@ -2,8 +2,7 @@ "extends": "../../../tsconfig.json", "compilerOptions": { "outDir": "../build", - "module": "es6", - "target": "es6" + "module": "commonjs", }, "include": [ "./**/*.ts", diff --git a/packages/hdom-components/package.json b/packages/hdom-components/package.json index f625863697..d246a91ec6 100644 --- a/packages/hdom-components/package.json +++ b/packages/hdom-components/package.json @@ -2,7 +2,9 @@ "name": "@thi.ng/hdom-components", "version": "2.4.6", "description": "Raw, skinnable UI & SVG components for @thi.ng/hdom", - "main": "./index.js", + "module": "./index.js", + "main": "./lib/index.js", + "umd:main": "./lib/index.umd.js", "typings": "./index.d.ts", "repository": { "type": "git", @@ -12,12 +14,14 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "build": "yarn clean && tsc --declaration", - "clean": "rimraf *.js *.d.ts .nyc_output build coverage doc", + "build": "yarn clean && yarn build:es6 && yarn build:bundle", + "build:es6": "tsc --declaration", + "build:bundle": "../../scripts/bundle-module hdomComponents api checks math transducers transducers-stats", + "test": "rimraf build && tsc -p test/tsconfig.json && nyc mocha build/test/*.js", + "clean": "rimraf *.js *.d.ts .nyc_output build coverage doc lib", "cover": "yarn test && nyc report --reporter=lcov", "doc": "node_modules/.bin/typedoc --mode modules --out doc src", - "pub": "yarn build && yarn publish --access public", - "test": "rimraf build && tsc -p test && nyc mocha build/test/*.js" + "pub": "yarn build && yarn publish --access public" }, "devDependencies": { "@types/mocha": "^5.2.5", @@ -41,5 +45,6 @@ ], "publishConfig": { "access": "public" - } + }, + "sideEffects": false } \ No newline at end of file diff --git a/packages/hdom-components/src/button-group.ts b/packages/hdom-components/src/button-group.ts index ad4f6d5109..294ab5cbfc 100644 --- a/packages/hdom-components/src/button-group.ts +++ b/packages/hdom-components/src/button-group.ts @@ -1,6 +1,5 @@ -import { IObjectOf } from "@thi.ng/api/api"; - -import { ButtonArgs, Button } from "./button"; +import { IObjectOf } from "@thi.ng/api"; +import { Button, ButtonArgs } from "./button"; import { mergeAttribs } from "./utils/merge-attribs"; /** diff --git a/packages/hdom-components/src/button.ts b/packages/hdom-components/src/button.ts index 96c4490fe1..e188584ccb 100644 --- a/packages/hdom-components/src/button.ts +++ b/packages/hdom-components/src/button.ts @@ -1,4 +1,4 @@ -import { IObjectOf } from "@thi.ng/api/api"; +import { IObjectOf } from "@thi.ng/api"; import { mergeAttribs } from "./utils/merge-attribs"; export interface ButtonOpts { diff --git a/packages/hdom-components/src/fps-counter.ts b/packages/hdom-components/src/fps-counter.ts index 695272d16e..9110b09785 100644 --- a/packages/hdom-components/src/fps-counter.ts +++ b/packages/hdom-components/src/fps-counter.ts @@ -1,5 +1,5 @@ -import { sma } from "@thi.ng/transducers-stats/sma"; -import { step } from "@thi.ng/transducers/step"; +import { step } from "@thi.ng/transducers"; +import { sma } from "@thi.ng/transducers-stats"; import { sparkline, SparklineOpts } from "./sparkline"; export interface FpsCounterOpts { diff --git a/packages/hdom-components/src/link.ts b/packages/hdom-components/src/link.ts index 3c8992ecd0..ff365e4246 100644 --- a/packages/hdom-components/src/link.ts +++ b/packages/hdom-components/src/link.ts @@ -1,4 +1,4 @@ -import { isString } from "@thi.ng/checks/is-string"; +import { isString } from "@thi.ng/checks"; export const link = (attribs: any, body: any) => ["a", isString(attribs) ? { href: attribs } : attribs, body]; diff --git a/packages/hdom-components/src/notification.ts b/packages/hdom-components/src/notification.ts index ce84778af9..94992beece 100644 --- a/packages/hdom-components/src/notification.ts +++ b/packages/hdom-components/src/notification.ts @@ -1,4 +1,4 @@ -import { IObjectOf } from "@thi.ng/api/api"; +import { IObjectOf } from "@thi.ng/api"; import { appLink } from "./link"; export interface NotificationOpts { diff --git a/packages/hdom-components/src/pager.ts b/packages/hdom-components/src/pager.ts index e729868f3f..a7a3426179 100644 --- a/packages/hdom-components/src/pager.ts +++ b/packages/hdom-components/src/pager.ts @@ -1,5 +1,4 @@ -import { range } from "@thi.ng/transducers/iter/range"; -import { map } from "@thi.ng/transducers/xform/map"; +import { map, range } from "@thi.ng/transducers"; /** * Configuration options for pager components. diff --git a/packages/hdom-components/src/sparkline.ts b/packages/hdom-components/src/sparkline.ts index d322b3e6b5..6938ed664b 100644 --- a/packages/hdom-components/src/sparkline.ts +++ b/packages/hdom-components/src/sparkline.ts @@ -1,6 +1,5 @@ -import { fitClamped } from "@thi.ng/math/fit"; -import { str } from "@thi.ng/transducers/rfn/str"; -import { mapIndexed } from "@thi.ng/transducers/xform/map-indexed"; +import { fitClamped } from "@thi.ng/math"; +import { mapIndexed, str } from "@thi.ng/transducers"; export interface SparklineOpts { /** diff --git a/packages/hdom-components/test/tsconfig.json b/packages/hdom-components/test/tsconfig.json index c93bb84899..2c9c12a650 100644 --- a/packages/hdom-components/test/tsconfig.json +++ b/packages/hdom-components/test/tsconfig.json @@ -2,8 +2,7 @@ "extends": "../../../tsconfig.json", "compilerOptions": { "outDir": "../build", - "module": "es6", - "target": "es6" + "module": "commonjs", }, "include": [ "./**/*.ts", diff --git a/packages/hdom-mock/package.json b/packages/hdom-mock/package.json index 4cae0a8bb4..acadd78cdc 100644 --- a/packages/hdom-mock/package.json +++ b/packages/hdom-mock/package.json @@ -1,8 +1,10 @@ { "name": "@thi.ng/hdom-mock", "version": "0.1.5", - "description": "TODO", - "main": "./index.js", + "description": "Mock base implementation for @thi.ng/hdom API", + "module": "./index.js", + "main": "./lib/index.js", + "umd:main": "./lib/index.umd.js", "typings": "./index.d.ts", "repository": { "type": "git", @@ -12,12 +14,14 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "build": "yarn clean && tsc --declaration", - "clean": "rimraf *.js *.d.ts .nyc_output build coverage doc", + "build": "yarn clean && yarn build:es6 && yarn build:bundle", + "build:es6": "tsc --declaration", + "build:bundle": "../../scripts/bundle-module hdomMock api checks hdom", + "test": "rimraf build && tsc -p test/tsconfig.json && nyc mocha build/test/*.js", + "clean": "rimraf *.js *.d.ts .nyc_output build coverage doc lib", "cover": "yarn test && nyc report --reporter=lcov", "doc": "node_modules/.bin/typedoc --mode modules --out doc src", - "pub": "yarn build && yarn publish --access public", - "test": "rimraf build && tsc -p test && nyc mocha build/test/*.js" + "pub": "yarn build && yarn publish --access public" }, "devDependencies": { "@types/mocha": "^5.2.5", @@ -29,6 +33,7 @@ }, "dependencies": { "@thi.ng/api": "^4.2.4", + "@thi.ng/checks": "^1.5.14", "@thi.ng/hdom": "^6.1.0" }, "keywords": [ @@ -37,5 +42,6 @@ ], "publishConfig": { "access": "public" - } + }, + "sideEffects": false } \ No newline at end of file diff --git a/packages/hdom-mock/src/index.ts b/packages/hdom-mock/src/index.ts index 5c9cc3f1f9..dce84334cd 100644 --- a/packages/hdom-mock/src/index.ts +++ b/packages/hdom-mock/src/index.ts @@ -1,9 +1,13 @@ -import { IObjectOf } from "@thi.ng/api/api"; -import { isFunction } from "@thi.ng/checks/is-function"; -import { HDOMImplementation, HDOMOpts } from "@thi.ng/hdom/api"; -import { diffTree } from "@thi.ng/hdom/diff"; -import { createTree, hydrateTree } from "@thi.ng/hdom/dom"; -import { normalizeTree } from "@thi.ng/hdom/normalize"; +import { IObjectOf } from "@thi.ng/api"; +import { isFunction } from "@thi.ng/checks"; +import { + createTree, + diffTree, + HDOMImplementation, + HDOMOpts, + hydrateTree, + normalizeTree +} from "@thi.ng/hdom"; export const TEXT = Symbol(); diff --git a/packages/hdom-mock/test/tsconfig.json b/packages/hdom-mock/test/tsconfig.json index c93bb84899..2c9c12a650 100644 --- a/packages/hdom-mock/test/tsconfig.json +++ b/packages/hdom-mock/test/tsconfig.json @@ -2,8 +2,7 @@ "extends": "../../../tsconfig.json", "compilerOptions": { "outDir": "../build", - "module": "es6", - "target": "es6" + "module": "commonjs", }, "include": [ "./**/*.ts", diff --git a/packages/hdom/package.json b/packages/hdom/package.json index 7d0d2fc27d..78b605829c 100644 --- a/packages/hdom/package.json +++ b/packages/hdom/package.json @@ -2,7 +2,9 @@ "name": "@thi.ng/hdom", "version": "6.1.0", "description": "Lightweight vanilla ES6 UI component trees with customizable branch-local behaviors", - "main": "./index.js", + "module": "./index.js", + "main": "./lib/index.js", + "umd:main": "./lib/index.umd.js", "typings": "./index.d.ts", "repository": { "type": "git", @@ -12,12 +14,14 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "build": "yarn clean && tsc --declaration", - "clean": "rimraf *.js *.d.ts .nyc_output build coverage doc", + "build": "yarn clean && yarn build:es6 && yarn build:bundle", + "build:es6": "tsc --declaration", + "build:bundle": "../../scripts/bundle-module hdom api checks diff equiv errors hiccup", + "test": "rimraf build && tsc -p test/tsconfig.json && nyc mocha build/test/*.js", + "clean": "rimraf *.js *.d.ts .nyc_output build coverage doc lib", "cover": "yarn test && nyc report --reporter=lcov", "doc": "node_modules/.bin/typedoc --mode modules --out doc src", - "pub": "yarn build && yarn publish --access public", - "test": "rimraf build && tsc -p test && nyc mocha build/test/*.js" + "pub": "yarn build && yarn publish --access public" }, "devDependencies": { "@thi.ng/atom": "^1.5.8", @@ -33,15 +37,20 @@ "@thi.ng/checks": "^1.5.14", "@thi.ng/diff": "^2.0.2", "@thi.ng/equiv": "^0.1.15", + "@thi.ng/errors": "^0.1.12", "@thi.ng/hiccup": "^2.7.2" }, "keywords": [ "browser", "components", + "data driven", + "declarative", "diff", "DOM", "ES6", + "functional", "IOC", + "iterators", "reactive", "typescript", "UI", @@ -49,5 +58,6 @@ ], "publishConfig": { "access": "public" - } + }, + "sideEffects": false } \ No newline at end of file diff --git a/packages/hdom/src/api.ts b/packages/hdom/src/api.ts index 4432edda9f..05a1f643d4 100644 --- a/packages/hdom/src/api.ts +++ b/packages/hdom/src/api.ts @@ -1,4 +1,4 @@ -import { IObjectOf } from "@thi.ng/api/api"; +import { IObjectOf } from "@thi.ng/api"; export interface ILifecycle { /** diff --git a/packages/hdom/src/diff.ts b/packages/hdom/src/diff.ts index d8717af3cd..aa29cdda68 100644 --- a/packages/hdom/src/diff.ts +++ b/packages/hdom/src/diff.ts @@ -1,7 +1,5 @@ -import { IObjectOf, SEMAPHORE } from "@thi.ng/api/api"; -import { DiffMode } from "@thi.ng/diff/api"; -import { diffArray } from "@thi.ng/diff/array"; -import { diffObject } from "@thi.ng/diff/object"; +import { IObjectOf, SEMAPHORE } from "@thi.ng/api"; +import { diffArray, DiffMode, diffObject } from "@thi.ng/diff"; import { equiv as _equiv, equivArrayLike, diff --git a/packages/hdom/src/dom.ts b/packages/hdom/src/dom.ts index 712823ff9d..06aa938878 100644 --- a/packages/hdom/src/dom.ts +++ b/packages/hdom/src/dom.ts @@ -1,11 +1,10 @@ -import * as isa from "@thi.ng/checks/is-array"; -import * as isi from "@thi.ng/checks/is-not-string-iterable"; -import { SVG_NS, SVG_TAGS } from "@thi.ng/hiccup/api"; -import { css } from "@thi.ng/hiccup/css"; +import { isArray as isa, isNotStringAndIterable as isi } from "@thi.ng/checks"; +import { SVG_NS, SVG_TAGS } from "@thi.ng/hiccup"; +import { css } from "@thi.ng/hiccup"; import { HDOMImplementation, HDOMOpts } from "./api"; -const isArray = isa.isArray; -const isNotStringAndIterable = isi.isNotStringAndIterable +const isArray = isa; +const isNotStringAndIterable = isi; /** * See `HDOMImplementation` interface for further details. diff --git a/packages/hdom/src/index.ts b/packages/hdom/src/index.ts index e33ab1e275..deb7075b81 100644 --- a/packages/hdom/src/index.ts +++ b/packages/hdom/src/index.ts @@ -5,3 +5,5 @@ export * from "./dom"; export * from "./normalize"; export * from "./render-once"; export * from "./start"; + +export * from "./utils"; diff --git a/packages/hdom/src/normalize.ts b/packages/hdom/src/normalize.ts index 2cd36f3422..575fa7c46c 100644 --- a/packages/hdom/src/normalize.ts +++ b/packages/hdom/src/normalize.ts @@ -1,13 +1,11 @@ -import * as isa from "@thi.ng/checks/is-array"; -import * as insi from "@thi.ng/checks/is-not-string-iterable"; -import * as iso from "@thi.ng/checks/is-plain-object"; -import { illegalArgs } from "@thi.ng/errors/illegal-arguments"; -import { NO_SPANS, TAG_REGEXP } from "@thi.ng/hiccup/api"; +import { isArray as isa, isNotStringAndIterable as isi, isPlainObject as iso } from "@thi.ng/checks"; +import { illegalArgs } from "@thi.ng/errors"; +import { NO_SPANS, TAG_REGEXP } from "@thi.ng/hiccup"; import { HDOMOpts } from "./api"; -const isArray = isa.isArray; -const isNotStringAndIterable = insi.isNotStringAndIterable; -const isPlainObject = iso.isPlainObject; +const isArray = isa; +const isNotStringAndIterable = isi; +const isPlainObject = iso; /** * Expands single hiccup element/component into its canonical form: diff --git a/packages/hdom/src/render-once.ts b/packages/hdom/src/render-once.ts index 740f558a29..63bc0b9985 100644 --- a/packages/hdom/src/render-once.ts +++ b/packages/hdom/src/render-once.ts @@ -1,4 +1,4 @@ -import { derefContext } from "@thi.ng/hiccup/deref"; +import { derefContext } from "@thi.ng/hiccup"; import { HDOMImplementation, HDOMOpts } from "./api"; import { DEFAULT_IMPL } from "./default"; import { resolveRoot } from "./utils"; diff --git a/packages/hdom/src/start.ts b/packages/hdom/src/start.ts index 6478803a9a..7efa32557c 100644 --- a/packages/hdom/src/start.ts +++ b/packages/hdom/src/start.ts @@ -1,4 +1,4 @@ -import { derefContext } from "@thi.ng/hiccup/deref"; +import { derefContext } from "@thi.ng/hiccup"; import { HDOMImplementation, HDOMOpts } from "./api"; import { DEFAULT_IMPL } from "./default"; import { resolveRoot } from "./utils"; diff --git a/packages/hdom/src/utils.ts b/packages/hdom/src/utils.ts index c2b1cdf99c..465f06addd 100644 --- a/packages/hdom/src/utils.ts +++ b/packages/hdom/src/utils.ts @@ -1,4 +1,4 @@ -import { isString } from "@thi.ng/checks/is-string"; +import { isString } from "@thi.ng/checks"; import { HDOMImplementation } from "./api"; export const resolveRoot = diff --git a/packages/hdom/test/index.ts b/packages/hdom/test/index.ts index 020c098d77..67d343e5bb 100644 --- a/packages/hdom/test/index.ts +++ b/packages/hdom/test/index.ts @@ -1,18 +1,15 @@ +import { Atom } from "@thi.ng/atom"; +import { derefContext } from "@thi.ng/hiccup"; +import { map, range } from "@thi.ng/iterators"; import * as assert from "assert"; - -import { Atom } from "@thi.ng/atom/atom"; -import { map } from "@thi.ng/iterators/map"; -import { range } from "@thi.ng/iterators/range"; import { normalizeTree } from "../src/normalize"; -import { derefContext } from "@thi.ng/hiccup/deref"; -function _check(a, b, ctx = null) { - assert.deepEqual(normalizeTree({ ctx, keys: false, span: false }, a), b); -} +const _check = + (a, b, ctx = null) => + assert.deepEqual(normalizeTree({ ctx, keys: false, span: false }, a), b); -function check(id, a, b) { - it(id, () => _check(a, b)); -} +const check = + (id, a, b) => it(id, () => _check(a, b)); describe("hdom", () => { diff --git a/packages/hdom/test/tsconfig.json b/packages/hdom/test/tsconfig.json index c93bb84899..2c9c12a650 100644 --- a/packages/hdom/test/tsconfig.json +++ b/packages/hdom/test/tsconfig.json @@ -2,8 +2,7 @@ "extends": "../../../tsconfig.json", "compilerOptions": { "outDir": "../build", - "module": "es6", - "target": "es6" + "module": "commonjs", }, "include": [ "./**/*.ts", diff --git a/packages/rstream-csp/package.json b/packages/rstream-csp/package.json index e2dc43550f..e74935ac7d 100644 --- a/packages/rstream-csp/package.json +++ b/packages/rstream-csp/package.json @@ -2,7 +2,9 @@ "name": "@thi.ng/rstream-csp", "version": "0.1.125", "description": "@thi.ng/csp bridge module for @thi.ng/rstream", - "main": "./index.js", + "module": "./index.js", + "main": "./lib/index.js", + "umd:main": "./lib/index.umd.js", "typings": "./index.d.ts", "repository": { "type": "git", @@ -12,12 +14,14 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "build": "yarn clean && tsc --declaration", - "clean": "rimraf *.js *.d.ts .nyc_output build coverage doc from", + "build": "yarn clean && yarn build:es6 && yarn build:bundle", + "build:es6": "tsc --declaration", + "build:bundle": "../../scripts/bundle-module rstreamCsp csp rstream", + "test": "rimraf build && tsc -p test/tsconfig.json && nyc mocha build/test/*.js", + "clean": "rimraf *.js *.d.ts .nyc_output build coverage doc lib from", "cover": "yarn test && nyc report --reporter=lcov", "doc": "node_modules/.bin/typedoc --mode modules --out doc src", - "pub": "yarn build && yarn publish --access public", - "test": "rimraf build && tsc -p test && nyc mocha build/test/*.js" + "pub": "yarn build && yarn publish --access public" }, "devDependencies": { "@types/mocha": "^5.2.5", @@ -41,5 +45,6 @@ ], "publishConfig": { "access": "public" - } + }, + "sideEffects": false } \ No newline at end of file diff --git a/packages/rstream-csp/src/from/channel.ts b/packages/rstream-csp/src/from/channel.ts index 6d5ca7f14d..790850eaf3 100644 --- a/packages/rstream-csp/src/from/channel.ts +++ b/packages/rstream-csp/src/from/channel.ts @@ -1,6 +1,5 @@ -import { Channel } from "@thi.ng/csp/channel"; -import { DEBUG } from "@thi.ng/rstream/api"; -import { Stream } from "@thi.ng/rstream/stream"; +import { Channel } from "@thi.ng/csp"; +import { DEBUG, Stream } from "@thi.ng/rstream"; /** * @@ -30,5 +29,5 @@ export const fromChannel = isActive = false; }; }, - `obs-${src.id}` + `channel-${src.id}` ); diff --git a/packages/rstream-csp/test/tsconfig.json b/packages/rstream-csp/test/tsconfig.json index c93bb84899..2c9c12a650 100644 --- a/packages/rstream-csp/test/tsconfig.json +++ b/packages/rstream-csp/test/tsconfig.json @@ -2,8 +2,7 @@ "extends": "../../../tsconfig.json", "compilerOptions": { "outDir": "../build", - "module": "es6", - "target": "es6" + "module": "commonjs", }, "include": [ "./**/*.ts", diff --git a/packages/rstream-csp/tsconfig.json b/packages/rstream-csp/tsconfig.json index bcf03f18b4..ad49a0c5d4 100644 --- a/packages/rstream-csp/tsconfig.json +++ b/packages/rstream-csp/tsconfig.json @@ -3,7 +3,7 @@ "compilerOptions": { "outDir": ".", "module": "es6", - "target": "es6" + "target": "esnext" }, "include": [ "./src/**/*.ts" diff --git a/packages/rstream-dot/package.json b/packages/rstream-dot/package.json index 746796a435..5681c72eee 100644 --- a/packages/rstream-dot/package.json +++ b/packages/rstream-dot/package.json @@ -2,7 +2,9 @@ "name": "@thi.ng/rstream-dot", "version": "0.2.64", "description": "Graphviz DOT conversion of @thi.ng/rstream dataflow graph topologies", - "main": "./index.js", + "module": "./index.js", + "main": "./lib/index.js", + "umd:main": "./lib/index.umd.js", "typings": "./index.d.ts", "repository": { "type": "git", @@ -12,12 +14,14 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "build": "yarn clean && tsc --declaration", - "clean": "rimraf *.js *.d.ts .nyc_output build coverage doc", + "build": "yarn clean && yarn build:es6 && yarn build:bundle", + "build:es6": "tsc --declaration", + "build:bundle": "../../scripts/bundle-module rstreamDot rstream", + "test": "rimraf build && tsc -p test/tsconfig.json && nyc mocha build/test/*.js", + "clean": "rimraf *.js *.d.ts .nyc_output build coverage doc lib", "cover": "yarn test && nyc report --reporter=lcov", "doc": "node_modules/.bin/typedoc --mode modules --out doc src", - "pub": "yarn build && yarn publish --access public", - "test": "rimraf build && tsc -p test && nyc mocha build/test/*.js" + "pub": "yarn build && yarn publish --access public" }, "devDependencies": { "@types/mocha": "^5.2.5", @@ -44,5 +48,6 @@ ], "publishConfig": { "access": "public" - } + }, + "sideEffects": false } \ No newline at end of file diff --git a/packages/rstream-dot/src/index.ts b/packages/rstream-dot/src/index.ts index bb0d49496e..9745ad37fe 100644 --- a/packages/rstream-dot/src/index.ts +++ b/packages/rstream-dot/src/index.ts @@ -1,8 +1,10 @@ +import { + ISubscribable, + Stream, + StreamMerge, + StreamSync +} from "@thi.ng/rstream"; import { DotOpts, Node, WalkState } from "./api"; -import { ISubscribable } from "@thi.ng/rstream/api"; -import { Stream } from "@thi.ng/rstream/stream"; -import { StreamMerge } from "@thi.ng/rstream/stream-merge"; -import { StreamSync } from "@thi.ng/rstream/stream-sync"; export * from "./api"; diff --git a/packages/rstream-dot/test/tsconfig.json b/packages/rstream-dot/test/tsconfig.json index c93bb84899..2c9c12a650 100644 --- a/packages/rstream-dot/test/tsconfig.json +++ b/packages/rstream-dot/test/tsconfig.json @@ -2,8 +2,7 @@ "extends": "../../../tsconfig.json", "compilerOptions": { "outDir": "../build", - "module": "es6", - "target": "es6" + "module": "commonjs", }, "include": [ "./**/*.ts", diff --git a/packages/rstream-gestures/package.json b/packages/rstream-gestures/package.json index 07c67dd4b4..145d3532a0 100644 --- a/packages/rstream-gestures/package.json +++ b/packages/rstream-gestures/package.json @@ -2,7 +2,9 @@ "name": "@thi.ng/rstream-gestures", "version": "0.6.9", "description": "Unified mouse, mouse wheel & single-touch event stream abstraction", - "main": "./index.js", + "module": "./index.js", + "main": "./lib/index.js", + "umd:main": "./lib/index.umd.js", "typings": "./index.d.ts", "repository": { "type": "git", @@ -12,12 +14,14 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "build": "yarn clean && tsc --declaration", - "clean": "rimraf *.js *.d.ts .nyc_output build coverage doc", + "build": "yarn clean && yarn build:es6 && yarn build:bundle", + "build:es6": "tsc --declaration", + "build:bundle": "../../scripts/bundle-module rstreamGestures api rstream transducers", + "test": "rimraf build && tsc -p test/tsconfig.json && nyc mocha build/test/*.js", + "clean": "rimraf *.js *.d.ts .nyc_output build coverage doc lib", "cover": "yarn test && nyc report --reporter=lcov", "doc": "node_modules/.bin/typedoc --mode modules --out doc src", - "pub": "yarn build && yarn publish --access public", - "test": "rimraf build && tsc -p test && nyc mocha build/test/*.js" + "pub": "yarn build && yarn publish --access public" }, "devDependencies": { "@types/mocha": "^5.2.5", @@ -40,11 +44,12 @@ "mouse", "mousewheel", "stream", + "rstream", "touch", "typescript" ], "publishConfig": { "access": "public" }, - "gitHead": "673bf50ff571fc65bd984d1f83929bcc69a8b394" + "sideEffects": false } \ No newline at end of file diff --git a/packages/rstream-gestures/src/index.ts b/packages/rstream-gestures/src/index.ts index 861c1c1b63..9cad9f5730 100644 --- a/packages/rstream-gestures/src/index.ts +++ b/packages/rstream-gestures/src/index.ts @@ -1,7 +1,6 @@ -import { IID } from "@thi.ng/api/api"; -import { fromEvent } from "@thi.ng/rstream/from/event"; -import { merge, StreamMerge } from "@thi.ng/rstream/stream-merge"; -import { map } from "@thi.ng/transducers/xform/map"; +import { IID } from "@thi.ng/api"; +import { fromEvent, merge, StreamMerge } from "@thi.ng/rstream"; +import { map } from "@thi.ng/transducers"; export const enum GestureType { START, diff --git a/packages/rstream-gestures/test/tsconfig.json b/packages/rstream-gestures/test/tsconfig.json index c93bb84899..2c9c12a650 100644 --- a/packages/rstream-gestures/test/tsconfig.json +++ b/packages/rstream-gestures/test/tsconfig.json @@ -2,8 +2,7 @@ "extends": "../../../tsconfig.json", "compilerOptions": { "outDir": "../build", - "module": "es6", - "target": "es6" + "module": "commonjs", }, "include": [ "./**/*.ts", diff --git a/packages/rstream-graph/package.json b/packages/rstream-graph/package.json index b769a30180..1bc3c62df1 100644 --- a/packages/rstream-graph/package.json +++ b/packages/rstream-graph/package.json @@ -2,7 +2,9 @@ "name": "@thi.ng/rstream-graph", "version": "2.1.50", "description": "Declarative dataflow graph construction for @thi.ng/rstream", - "main": "./index.js", + "module": "./index.js", + "main": "./lib/index.js", + "umd:main": "./lib/index.umd.js", "typings": "./index.d.ts", "repository": { "type": "git", @@ -12,12 +14,14 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "build": "yarn clean && tsc --declaration", - "clean": "rimraf *.js *.d.ts .nyc_output build coverage doc nodes", + "build": "yarn clean && yarn build:es6 && yarn build:bundle", + "build:es6": "tsc --declaration", + "build:bundle": "../../scripts/bundle-module rstreamGraph api checks errors paths resolve-map rstream transducers", + "test": "rimraf build && tsc -p test/tsconfig.json && nyc mocha build/test/*.js", + "clean": "rimraf *.js *.d.ts .nyc_output build coverage doc lib", "cover": "yarn test && nyc report --reporter=lcov", "doc": "node_modules/.bin/typedoc --mode modules --out doc src", - "pub": "yarn build && yarn publish --access public", - "test": "rimraf build && tsc -p test && nyc mocha build/test/*.js" + "pub": "yarn build && yarn publish --access public" }, "devDependencies": { "@types/mocha": "^5.2.5", @@ -42,10 +46,12 @@ "ES6", "graph", "reactive", + "stream", "rstream", "typescript" ], "publishConfig": { "access": "public" - } + }, + "sideEffects": false } \ No newline at end of file diff --git a/packages/rstream-graph/src/api.ts b/packages/rstream-graph/src/api.ts index 17e8b6d9ec..cffd521299 100644 --- a/packages/rstream-graph/src/api.ts +++ b/packages/rstream-graph/src/api.ts @@ -1,8 +1,8 @@ -import { Fn, IObjectOf } from "@thi.ng/api/api"; +import { Fn, IObjectOf } from "@thi.ng/api"; import { Path } from "@thi.ng/paths"; import { ResolveFn } from "@thi.ng/resolve-map"; -import { ISubscribable } from "@thi.ng/rstream/api"; -import { Transducer } from "@thi.ng/transducers/api"; +import { ISubscribable } from "@thi.ng/rstream"; +import { Transducer } from "@thi.ng/transducers"; /** * A function which constructs and returns an `ISubscribable` using diff --git a/packages/rstream-graph/src/graph.ts b/packages/rstream-graph/src/graph.ts index a07afb0056..83bca12679 100644 --- a/packages/rstream-graph/src/graph.ts +++ b/packages/rstream-graph/src/graph.ts @@ -1,17 +1,17 @@ -import { IObjectOf } from "@thi.ng/api/api"; -import { IAtom } from "@thi.ng/atom/api"; -import { isFunction } from "@thi.ng/checks/is-function"; -import { isPlainObject } from "@thi.ng/checks/is-plain-object"; -import { isString } from "@thi.ng/checks/is-string"; -import { illegalArgs } from "@thi.ng/errors/illegal-arguments"; +import { IObjectOf } from "@thi.ng/api"; +import { IAtom } from "@thi.ng/atom"; +import { isFunction, isPlainObject, isString } from "@thi.ng/checks"; +import { illegalArgs } from "@thi.ng/errors"; import { getIn } from "@thi.ng/paths"; import { absPath, resolve, ResolveFn } from "@thi.ng/resolve-map"; -import { ISubscribable } from "@thi.ng/rstream/api"; -import { fromIterableSync } from "@thi.ng/rstream/from/iterable"; -import { fromView } from "@thi.ng/rstream/from/view"; -import { StreamSync, sync } from "@thi.ng/rstream/stream-sync"; -import { Transducer } from "@thi.ng/transducers/api"; -import { map } from "@thi.ng/transducers/xform/map"; +import { + fromIterableSync, + fromView, + ISubscribable, + StreamSync, + sync +} from "@thi.ng/rstream"; +import { map, Transducer } from "@thi.ng/transducers"; import { Graph, GraphSpec, diff --git a/packages/rstream-graph/src/nodes/extract.ts b/packages/rstream-graph/src/nodes/extract.ts index 98b092ec57..6a4bbcd773 100644 --- a/packages/rstream-graph/src/nodes/extract.ts +++ b/packages/rstream-graph/src/nodes/extract.ts @@ -1,6 +1,5 @@ import { getIn, Path } from "@thi.ng/paths"; -import { map } from "@thi.ng/transducers/xform/map"; - +import { map } from "@thi.ng/transducers"; import { NodeFactory } from "../api"; import { node1 } from "../graph"; diff --git a/packages/rstream-graph/src/nodes/math.ts b/packages/rstream-graph/src/nodes/math.ts index 6878a3c3ec..7e0b76b02b 100644 --- a/packages/rstream-graph/src/nodes/math.ts +++ b/packages/rstream-graph/src/nodes/math.ts @@ -1,6 +1,5 @@ -import { IObjectOf } from "@thi.ng/api/api"; -import { map } from "@thi.ng/transducers/xform/map"; - +import { IObjectOf } from "@thi.ng/api"; +import { map } from "@thi.ng/transducers"; import { NodeFactory } from "../api"; import { node } from "../graph"; diff --git a/packages/rstream-graph/test/index.ts b/packages/rstream-graph/test/index.ts index ab6d50717f..1fa9786f8b 100644 --- a/packages/rstream-graph/test/index.ts +++ b/packages/rstream-graph/test/index.ts @@ -1,8 +1,7 @@ import { Atom } from "@thi.ng/atom"; import * as rs from "@thi.ng/rstream"; -import { map } from "@thi.ng/transducers/xform/map"; +import { map } from "@thi.ng/transducers"; import * as assert from "assert"; - import * as rsg from "../src"; describe("rstream-graph", () => { diff --git a/packages/rstream-graph/test/tsconfig.json b/packages/rstream-graph/test/tsconfig.json index c93bb84899..2c9c12a650 100644 --- a/packages/rstream-graph/test/tsconfig.json +++ b/packages/rstream-graph/test/tsconfig.json @@ -2,8 +2,7 @@ "extends": "../../../tsconfig.json", "compilerOptions": { "outDir": "../build", - "module": "es6", - "target": "es6" + "module": "commonjs", }, "include": [ "./**/*.ts", diff --git a/packages/rstream-log/package.json b/packages/rstream-log/package.json index ea40694367..399c00a7be 100644 --- a/packages/rstream-log/package.json +++ b/packages/rstream-log/package.json @@ -2,7 +2,9 @@ "name": "@thi.ng/rstream-log", "version": "1.0.76", "description": "Structured, multilevel & hierarchical loggers based on @thi.ng/rstream", - "main": "./index.js", + "module": "./index.js", + "main": "./lib/index.js", + "umd:main": "./lib/index.umd.js", "typings": "./index.d.ts", "repository": { "type": "git", @@ -12,12 +14,14 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "build": "yarn clean && tsc --declaration", - "clean": "rimraf *.js *.d.ts .nyc_output build coverage doc output xform", + "build": "yarn clean && yarn build:es6 && yarn build:bundle", + "build:es6": "tsc --declaration", + "build:bundle": "../../scripts/bundle-module rstreamLog api checks errors rstream transducers", + "test": "rimraf build && tsc -p test/tsconfig.json && nyc mocha build/test/*.js", + "clean": "rimraf *.js *.d.ts .nyc_output build coverage doc lib", "cover": "yarn test && nyc report --reporter=lcov", "doc": "node_modules/.bin/typedoc --mode modules --out doc src", - "pub": "yarn build && yarn publish --access public", - "test": "rimraf build && tsc -p test && nyc mocha build/test/*.js" + "pub": "yarn build && yarn publish --access public" }, "devDependencies": { "@types/mocha": "^5.2.5", @@ -47,5 +51,6 @@ ], "publishConfig": { "access": "public" - } + }, + "sideEffects": false } \ No newline at end of file diff --git a/packages/rstream-log/src/api.ts b/packages/rstream-log/src/api.ts index 38942c1ca8..35356cf87b 100644 --- a/packages/rstream-log/src/api.ts +++ b/packages/rstream-log/src/api.ts @@ -1,5 +1,5 @@ -import { IID } from "@thi.ng/api/api"; -import { ISubscribable } from "@thi.ng/rstream/api"; +import { IID } from "@thi.ng/api"; +import { ISubscribable } from "@thi.ng/rstream"; export const enum Level { FINE, diff --git a/packages/rstream-log/src/logger.ts b/packages/rstream-log/src/logger.ts index 226fba8968..c662eb0c97 100644 --- a/packages/rstream-log/src/logger.ts +++ b/packages/rstream-log/src/logger.ts @@ -1,8 +1,5 @@ -import { illegalArity } from "@thi.ng/errors/illegal-arity"; -import { ISubscribable } from "@thi.ng/rstream/api"; -import { StreamMerge } from "@thi.ng/rstream/stream-merge"; -import { nextID } from "@thi.ng/rstream/utils/idgen"; - +import { illegalArity } from "@thi.ng/errors"; +import { ISubscribable, nextID, StreamMerge } from "@thi.ng/rstream"; import { ILogger, Level, LogEntry } from "./api"; export class Logger extends StreamMerge implements diff --git a/packages/rstream-log/src/output/console.ts b/packages/rstream-log/src/output/console.ts index 3c1da18296..8d93f3a145 100644 --- a/packages/rstream-log/src/output/console.ts +++ b/packages/rstream-log/src/output/console.ts @@ -1 +1 @@ -export { trace as writeConsole } from "@thi.ng/rstream/subs/trace"; +export { trace as writeConsole } from "@thi.ng/rstream"; diff --git a/packages/rstream-log/src/output/file.ts b/packages/rstream-log/src/output/file.ts index ef410ea80f..3e0d153e2f 100644 --- a/packages/rstream-log/src/output/file.ts +++ b/packages/rstream-log/src/output/file.ts @@ -1,6 +1,6 @@ -import { isNode } from "@thi.ng/checks/is-node"; -import { unsupported } from "@thi.ng/errors/unsupported"; -import { ISubscriber } from "@thi.ng/rstream/api"; +import { isNode } from "@thi.ng/checks"; +import { unsupported } from "@thi.ng/errors"; +import { ISubscriber } from "@thi.ng/rstream"; export const writeFile = (path: string): ISubscriber => { diff --git a/packages/rstream-log/src/xform/filter.ts b/packages/rstream-log/src/xform/filter.ts index 4fdfb48096..fa3496e097 100644 --- a/packages/rstream-log/src/xform/filter.ts +++ b/packages/rstream-log/src/xform/filter.ts @@ -1,7 +1,6 @@ -import { isString } from "@thi.ng/checks/is-string"; -import { Transducer } from "@thi.ng/transducers/api"; -import { filter } from "@thi.ng/transducers/xform/filter"; - +import { isString } from "@thi.ng/checks"; +import { Transducer } from "@thi.ng/transducers"; +import { filter } from "@thi.ng/transducers"; import { Level, LogEntry } from "../api"; export const onlyLevel = diff --git a/packages/rstream-log/src/xform/format.ts b/packages/rstream-log/src/xform/format.ts index 93690007d6..cb4560b320 100644 --- a/packages/rstream-log/src/xform/format.ts +++ b/packages/rstream-log/src/xform/format.ts @@ -1,5 +1,4 @@ -import { Transducer } from "@thi.ng/transducers/api"; -import { map } from "@thi.ng/transducers/xform/map"; +import { map, Transducer } from "@thi.ng/transducers"; import { __Level, BodyFormat, diff --git a/packages/rstream-log/test/tsconfig.json b/packages/rstream-log/test/tsconfig.json index c93bb84899..2c9c12a650 100644 --- a/packages/rstream-log/test/tsconfig.json +++ b/packages/rstream-log/test/tsconfig.json @@ -2,8 +2,7 @@ "extends": "../../../tsconfig.json", "compilerOptions": { "outDir": "../build", - "module": "es6", - "target": "es6" + "module": "commonjs", }, "include": [ "./**/*.ts", diff --git a/packages/rstream-query/package.json b/packages/rstream-query/package.json index b1c1a98590..acadeea0b0 100644 --- a/packages/rstream-query/package.json +++ b/packages/rstream-query/package.json @@ -2,7 +2,9 @@ "name": "@thi.ng/rstream-query", "version": "0.3.63", "description": "@thi.ng/rstream based triple store & reactive query engine", - "main": "./index.js", + "module": "./index.js", + "main": "./lib/index.js", + "umd:main": "./lib/index.umd.js", "typings": "./index.d.ts", "repository": { "type": "git", @@ -12,12 +14,14 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "build": "yarn clean && tsc --declaration", - "clean": "rimraf *.js *.d.ts .nyc_output build coverage doc", + "build": "yarn clean && yarn build:es6 && yarn build:bundle", + "build:es6": "tsc --declaration", + "build:bundle": "../../scripts/bundle-module rstreamQuery api associative checks equiv errors rstream rstream-dot transducers", + "test": "rimraf build && tsc -p test/tsconfig.json && nyc mocha build/test/*.js", + "clean": "rimraf *.js *.d.ts .nyc_output build coverage doc lib", "cover": "yarn test && nyc report --reporter=lcov", "doc": "node_modules/.bin/typedoc --mode modules --out doc src", - "pub": "yarn build && yarn publish --access public", - "test": "rimraf build && tsc -p test && nyc mocha build/test/*.js" + "pub": "yarn build && yarn publish --access public" }, "devDependencies": { "@types/mocha": "^5.2.5", @@ -53,5 +57,6 @@ ], "publishConfig": { "access": "public" - } + }, + "sideEffects": false } \ No newline at end of file diff --git a/packages/rstream-query/src/api.ts b/packages/rstream-query/src/api.ts index a23af9c641..905ffb9ab9 100644 --- a/packages/rstream-query/src/api.ts +++ b/packages/rstream-query/src/api.ts @@ -1,5 +1,5 @@ -import { IObjectOf } from "@thi.ng/api/api"; -import { ISubscribable } from "@thi.ng/rstream/api"; +import { IObjectOf } from "@thi.ng/api"; +import { ISubscribable } from "@thi.ng/rstream"; export let DEBUG = false; diff --git a/packages/rstream-query/src/convert.ts b/packages/rstream-query/src/convert.ts index ca03bee3bc..4a4105a3ef 100644 --- a/packages/rstream-query/src/convert.ts +++ b/packages/rstream-query/src/convert.ts @@ -1,8 +1,5 @@ -import { isArray } from "@thi.ng/checks/is-array"; -import { isPlainObject } from "@thi.ng/checks/is-plain-object"; -import { concat } from "@thi.ng/transducers/iter/concat"; -import { pairs } from "@thi.ng/transducers/iter/pairs"; -import { mapcat } from "@thi.ng/transducers/xform/mapcat"; +import { isArray, isPlainObject } from "@thi.ng/checks"; +import { concat, pairs, mapcat } from "@thi.ng/transducers"; let NEXT_ID = 0; diff --git a/packages/rstream-query/src/pattern.ts b/packages/rstream-query/src/pattern.ts index 97ae8667bc..66282f7f51 100644 --- a/packages/rstream-query/src/pattern.ts +++ b/packages/rstream-query/src/pattern.ts @@ -1,5 +1,4 @@ -import { repeatedly } from "@thi.ng/transducers/iter/repeatedly"; - +import { repeatedly } from "@thi.ng/transducers"; import { PathPattern, Pattern } from "./api"; import { autoQVar, isQVar, qvarName } from "./qvar"; diff --git a/packages/rstream-query/src/qvar.ts b/packages/rstream-query/src/qvar.ts index 5e0373fdf4..a5a7b597cd 100644 --- a/packages/rstream-query/src/qvar.ts +++ b/packages/rstream-query/src/qvar.ts @@ -1,4 +1,4 @@ -import { isString } from "@thi.ng/checks/is-string"; +import { isString } from "@thi.ng/checks"; import { Triple } from "./api"; const AUTO_QVAR_PREFIX = "?__q"; diff --git a/packages/rstream-query/src/store.ts b/packages/rstream-query/src/store.ts index 14f90bd59e..af25261415 100644 --- a/packages/rstream-query/src/store.ts +++ b/packages/rstream-query/src/store.ts @@ -1,28 +1,32 @@ -import { IObjectOf } from "@thi.ng/api/api"; -import { intersection } from "@thi.ng/associative/intersection"; -import { join } from "@thi.ng/associative/join"; +import { IObjectOf } from "@thi.ng/api"; +import { intersection, join } from "@thi.ng/associative"; import { equiv } from "@thi.ng/equiv"; -import { illegalArgs } from "@thi.ng/errors/illegal-arguments"; +import { illegalArgs } from "@thi.ng/errors"; +import { + ISubscribable, + nextID, + Stream, + Subscription, + sync +} from "@thi.ng/rstream"; import { DotOpts, IToDot, toDot, walk } from "@thi.ng/rstream-dot"; -import { ISubscribable } from "@thi.ng/rstream/api"; -import { Stream } from "@thi.ng/rstream/stream"; -import { sync } from "@thi.ng/rstream/stream-sync"; -import { Subscription } from "@thi.ng/rstream/subscription"; -import { nextID } from "@thi.ng/rstream/utils/idgen"; -import { Reducer, Transducer } from "@thi.ng/transducers/api"; -import { comp } from "@thi.ng/transducers/func/comp"; -import { compR } from "@thi.ng/transducers/func/compr"; -import { keySelector } from "@thi.ng/transducers/func/key-selector"; -import { assocObj } from "@thi.ng/transducers/rfn/assoc-obj"; -import { transduce } from "@thi.ng/transducers/transduce"; -import { dedupe } from "@thi.ng/transducers/xform/dedupe"; -import { map } from "@thi.ng/transducers/xform/map"; -import { mapIndexed } from "@thi.ng/transducers/xform/map-indexed"; +import { + assocObj, + comp, + compR, + dedupe, + keySelector, + map, + mapIndexed, + Reducer, + transduce, + Transducer +} from "@thi.ng/transducers"; import { BindFn, DEBUG, diff --git a/packages/rstream-query/test/tsconfig.json b/packages/rstream-query/test/tsconfig.json index c93bb84899..2c9c12a650 100644 --- a/packages/rstream-query/test/tsconfig.json +++ b/packages/rstream-query/test/tsconfig.json @@ -2,8 +2,7 @@ "extends": "../../../tsconfig.json", "compilerOptions": { "outDir": "../build", - "module": "es6", - "target": "es6" + "module": "commonjs", }, "include": [ "./**/*.ts", diff --git a/packages/rstream/package.json b/packages/rstream/package.json index a0db67dd8c..9d394ddab7 100644 --- a/packages/rstream/package.json +++ b/packages/rstream/package.json @@ -2,7 +2,9 @@ "name": "@thi.ng/rstream", "version": "1.14.9", "description": "Reactive multi-tap streams, dataflow & transformation pipeline constructs", - "main": "./index.js", + "module": "./index.js", + "main": "./lib/index.js", + "umd:main": "./lib/index.umd.js", "typings": "./index.d.ts", "repository": { "type": "git", @@ -12,12 +14,14 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "build": "yarn clean && tsc --declaration", - "clean": "rimraf *.js *.d.ts .nyc_output build coverage doc from subs utils", + "build": "yarn clean && yarn build:es6 && yarn build:bundle", + "build:es6": "tsc --declaration", + "build:bundle": "../../scripts/bundle-module rstream api associative atom checks errors paths transducers", + "test": "rimraf build && tsc -p test/tsconfig.json && nyc mocha build/test/*.js", + "clean": "rimraf *.js *.d.ts .nyc_output build coverage doc lib from subs utils", "cover": "yarn test && nyc report --reporter=lcov", "doc": "node_modules/.bin/typedoc --mode modules --out doc src", - "pub": "yarn build && yarn publish --access public", - "test": "rimraf build && tsc -p test && nyc mocha build/test/*.js" + "pub": "yarn build && yarn publish --access public" }, "devDependencies": { "@types/mocha": "^5.2.5", @@ -50,5 +54,6 @@ ], "publishConfig": { "access": "public" - } + }, + "sideEffects": false } \ No newline at end of file diff --git a/packages/rstream/src/api.ts b/packages/rstream/src/api.ts index 4de3d382a9..cd7a98ba41 100644 --- a/packages/rstream/src/api.ts +++ b/packages/rstream/src/api.ts @@ -1,6 +1,5 @@ -import { IDeref, IID } from "@thi.ng/api/api"; -import { Transducer } from "@thi.ng/transducers/api"; - +import { IDeref, IID } from "@thi.ng/api"; +import { Transducer } from "@thi.ng/transducers"; import { Stream } from "./stream"; import { Subscription } from "./subscription"; diff --git a/packages/rstream/src/from/atom.ts b/packages/rstream/src/from/atom.ts index 4918b1aea7..a3bcded55b 100644 --- a/packages/rstream/src/from/atom.ts +++ b/packages/rstream/src/from/atom.ts @@ -1,5 +1,5 @@ -import { Predicate2 } from "@thi.ng/api/api"; -import { ReadonlyAtom } from "@thi.ng/atom/api"; +import { Predicate2 } from "@thi.ng/api"; +import { ReadonlyAtom } from "@thi.ng/atom"; import { Stream } from "../stream"; import { nextID } from "../utils/idgen"; diff --git a/packages/rstream/src/from/promises.ts b/packages/rstream/src/from/promises.ts index e270152323..13919b3681 100644 --- a/packages/rstream/src/from/promises.ts +++ b/packages/rstream/src/from/promises.ts @@ -1,5 +1,4 @@ -import { mapcat } from "@thi.ng/transducers/xform/mapcat"; - +import { mapcat } from "@thi.ng/transducers"; import { Subscription } from "../subscription"; import { fromPromise } from "./promise"; diff --git a/packages/rstream/src/from/raf.ts b/packages/rstream/src/from/raf.ts index 5709308fef..edf0701c04 100644 --- a/packages/rstream/src/from/raf.ts +++ b/packages/rstream/src/from/raf.ts @@ -1,4 +1,4 @@ -import { isNode } from "@thi.ng/checks/is-node"; +import { isNode } from "@thi.ng/checks"; import { Stream } from "../stream"; import { nextID } from "../utils/idgen"; import { fromInterval } from "./interval"; diff --git a/packages/rstream/src/from/view.ts b/packages/rstream/src/from/view.ts index 5727abf681..62cf8f91ab 100644 --- a/packages/rstream/src/from/view.ts +++ b/packages/rstream/src/from/view.ts @@ -1,6 +1,6 @@ -import { Predicate2 } from "@thi.ng/api/api"; -import { ReadonlyAtom, ViewTransform } from "@thi.ng/atom/api"; -import { View } from "@thi.ng/atom/view"; +import { Predicate2 } from "@thi.ng/api"; +import { ReadonlyAtom, ViewTransform } from "@thi.ng/atom"; +import { View } from "@thi.ng/atom"; import { Path } from "@thi.ng/paths"; import { Stream } from "../stream"; import { nextID } from "../utils/idgen"; diff --git a/packages/rstream/src/index.ts b/packages/rstream/src/index.ts index 007933fc25..3e76db7cf1 100644 --- a/packages/rstream/src/index.ts +++ b/packages/rstream/src/index.ts @@ -25,4 +25,5 @@ export * from "./subs/trace"; export * from "./subs/transduce"; export * from "./subs/tunnel"; +export * from "./utils/idgen"; export * from "./utils/worker"; diff --git a/packages/rstream/src/pubsub.ts b/packages/rstream/src/pubsub.ts index 3eab862b94..f357d53b9d 100644 --- a/packages/rstream/src/pubsub.ts +++ b/packages/rstream/src/pubsub.ts @@ -1,7 +1,7 @@ -import { Predicate2 } from "@thi.ng/api/api"; -import { EquivMap } from "@thi.ng/associative/equiv-map"; -import { unsupported } from "@thi.ng/errors/unsupported"; -import { Transducer } from "@thi.ng/transducers/api"; +import { Predicate2 } from "@thi.ng/api"; +import { EquivMap } from "@thi.ng/associative"; +import { unsupported } from "@thi.ng/errors"; +import { Transducer } from "@thi.ng/transducers"; import { DEBUG, ISubscriber } from "./api"; import { Subscription, subscription } from "./subscription"; import { nextID } from "./utils/idgen"; diff --git a/packages/rstream/src/stream-merge.ts b/packages/rstream/src/stream-merge.ts index d85de9b07b..6ba2696e3c 100644 --- a/packages/rstream/src/stream-merge.ts +++ b/packages/rstream/src/stream-merge.ts @@ -1,5 +1,5 @@ -import { IID } from "@thi.ng/api/api"; -import { Transducer } from "@thi.ng/transducers/api"; +import { IID } from "@thi.ng/api"; +import { Transducer } from "@thi.ng/transducers"; import { ISubscribable, State } from "./api"; import { Subscription } from "./subscription"; import { nextID } from "./utils/idgen"; diff --git a/packages/rstream/src/stream-sync.ts b/packages/rstream/src/stream-sync.ts index 9e84af3855..dd3c46196d 100644 --- a/packages/rstream/src/stream-sync.ts +++ b/packages/rstream/src/stream-sync.ts @@ -1,10 +1,12 @@ -import { IID, IObjectOf } from "@thi.ng/api/api"; -import { isPlainObject } from "@thi.ng/checks/is-plain-object"; -import { Transducer } from "@thi.ng/transducers/api"; -import { comp } from "@thi.ng/transducers/func/comp"; -import { labeled } from "@thi.ng/transducers/xform/labeled"; -import { mapVals } from "@thi.ng/transducers/xform/map-vals"; -import { partitionSync } from "@thi.ng/transducers/xform/partition-sync"; +import { IID, IObjectOf } from "@thi.ng/api"; +import { isPlainObject } from "@thi.ng/checks"; +import { + comp, + labeled, + mapVals, + partitionSync, + Transducer +} from "@thi.ng/transducers"; import { ISubscribable, State } from "./api"; import { Subscription } from "./subscription"; import { nextID } from "./utils/idgen"; diff --git a/packages/rstream/src/stream.ts b/packages/rstream/src/stream.ts index e18066a007..dc96d2902e 100644 --- a/packages/rstream/src/stream.ts +++ b/packages/rstream/src/stream.ts @@ -1,6 +1,6 @@ -import { isString } from "@thi.ng/checks/is-string"; -import { illegalArity } from "@thi.ng/errors/illegal-arity"; -import { Transducer } from "@thi.ng/transducers/api"; +import { isString } from "@thi.ng/checks"; +import { illegalArity } from "@thi.ng/errors"; +import { Transducer } from "@thi.ng/transducers"; import { DEBUG, IStream, diff --git a/packages/rstream/src/subs/bisect.ts b/packages/rstream/src/subs/bisect.ts index 5d8d7b03eb..a3e7068fdf 100644 --- a/packages/rstream/src/subs/bisect.ts +++ b/packages/rstream/src/subs/bisect.ts @@ -1,5 +1,4 @@ -import { Predicate } from "@thi.ng/api/api"; - +import { Predicate } from "@thi.ng/api"; import { ISubscriber } from "../api"; import { PubSub } from "../pubsub"; diff --git a/packages/rstream/src/subs/post-worker.ts b/packages/rstream/src/subs/post-worker.ts index 581263b593..f1fc5d2df2 100644 --- a/packages/rstream/src/subs/post-worker.ts +++ b/packages/rstream/src/subs/post-worker.ts @@ -1,6 +1,5 @@ -import { isTransferable } from "@thi.ng/checks/is-transferable"; -import { isTypedArray } from "@thi.ng/checks/is-typedarray"; - +import { isTransferable } from "@thi.ng/checks"; +import { isTypedArray } from "@thi.ng/checks"; import { DEBUG, ISubscriber } from "../api"; import { makeWorker } from "../utils/worker"; diff --git a/packages/rstream/src/subs/resolve.ts b/packages/rstream/src/subs/resolve.ts index 8973c7d873..ef1323751c 100644 --- a/packages/rstream/src/subs/resolve.ts +++ b/packages/rstream/src/subs/resolve.ts @@ -1,4 +1,4 @@ -import { IID } from "@thi.ng/api/api"; +import { IID } from "@thi.ng/api"; import { __State, DEBUG, State } from "../api"; import { Subscription } from "../subscription"; import { nextID } from "../utils/idgen"; diff --git a/packages/rstream/src/subs/sidechain-partition.ts b/packages/rstream/src/subs/sidechain-partition.ts index f39c331e4a..b05d8efaab 100644 --- a/packages/rstream/src/subs/sidechain-partition.ts +++ b/packages/rstream/src/subs/sidechain-partition.ts @@ -1,4 +1,4 @@ -import { Predicate } from "@thi.ng/api/api"; +import { Predicate } from "@thi.ng/api"; import { ISubscribable, State } from "../api"; import { Subscription } from "../subscription"; import { nextID } from "../utils/idgen"; diff --git a/packages/rstream/src/subs/sidechain-toggle.ts b/packages/rstream/src/subs/sidechain-toggle.ts index 5c0aac4e00..fe2983dad5 100644 --- a/packages/rstream/src/subs/sidechain-toggle.ts +++ b/packages/rstream/src/subs/sidechain-toggle.ts @@ -1,4 +1,4 @@ -import { Predicate } from "@thi.ng/api/api"; +import { Predicate } from "@thi.ng/api"; import { ISubscribable } from "../api"; import { Subscription } from "../subscription"; import { nextID } from "../utils/idgen"; diff --git a/packages/rstream/src/subs/transduce.ts b/packages/rstream/src/subs/transduce.ts index 22d7b8231b..1be3645bd2 100644 --- a/packages/rstream/src/subs/transduce.ts +++ b/packages/rstream/src/subs/transduce.ts @@ -1,6 +1,5 @@ -import { Reducer, Transducer } from "@thi.ng/transducers/api"; -import { isReduced } from "@thi.ng/transducers/reduced"; - +import { Reducer, Transducer } from "@thi.ng/transducers"; +import { isReduced } from "@thi.ng/transducers"; import { Subscription } from "../subscription"; /** diff --git a/packages/rstream/src/subscription.ts b/packages/rstream/src/subscription.ts index 4ede83e114..d2357da73b 100644 --- a/packages/rstream/src/subscription.ts +++ b/packages/rstream/src/subscription.ts @@ -1,13 +1,14 @@ -import { IDeref, SEMAPHORE } from "@thi.ng/api/api"; -import { implementsFunction } from "@thi.ng/checks/implements-function"; -import { isFunction } from "@thi.ng/checks/is-function"; -import { isString } from "@thi.ng/checks/is-string"; -import { illegalArity } from "@thi.ng/errors/illegal-arity"; -import { illegalState } from "@thi.ng/errors/illegal-state"; -import { Reducer, Transducer } from "@thi.ng/transducers/api"; -import { comp } from "@thi.ng/transducers/func/comp"; -import { isReduced, unreduced } from "@thi.ng/transducers/reduced"; -import { push } from "@thi.ng/transducers/rfn/push"; +import { IDeref, SEMAPHORE } from "@thi.ng/api"; +import { implementsFunction, isFunction, isString } from "@thi.ng/checks"; +import { illegalArity, illegalState } from "@thi.ng/errors"; +import { + comp, + isReduced, + push, + Reducer, + Transducer, + unreduced +} from "@thi.ng/transducers"; import { __State, DEBUG, diff --git a/packages/rstream/src/utils/worker.ts b/packages/rstream/src/utils/worker.ts index 20588eba9a..017d98a747 100644 --- a/packages/rstream/src/utils/worker.ts +++ b/packages/rstream/src/utils/worker.ts @@ -1,6 +1,6 @@ -export function inlineWorker(src: string) { - return makeWorker(new Blob([src], { type: "text/javascript" })); -} +export const inlineWorker = + (src: string) => + makeWorker(new Blob([src], { type: "text/javascript" })); export const makeWorker = (worker: Worker | string | Blob) => diff --git a/packages/rstream/test/tsconfig.json b/packages/rstream/test/tsconfig.json index c93bb84899..2c9c12a650 100644 --- a/packages/rstream/test/tsconfig.json +++ b/packages/rstream/test/tsconfig.json @@ -2,8 +2,7 @@ "extends": "../../../tsconfig.json", "compilerOptions": { "outDir": "../build", - "module": "es6", - "target": "es6" + "module": "commonjs", }, "include": [ "./**/*.ts", diff --git a/packages/transducers-hdom/package.json b/packages/transducers-hdom/package.json index bedf9e3ec6..7013d62553 100644 --- a/packages/transducers-hdom/package.json +++ b/packages/transducers-hdom/package.json @@ -2,7 +2,9 @@ "name": "@thi.ng/transducers-hdom", "version": "1.2.16", "description": "Transducer based UI updater for @thi.ng/hdom", - "main": "./index.js", + "module": "./index.js", + "main": "./lib/index.js", + "umd:main": "./lib/index.umd.js", "typings": "./index.d.ts", "repository": { "type": "git", @@ -12,12 +14,14 @@ "author": "Karsten Schmidt ", "license": "Apache-2.0", "scripts": { - "build": "yarn clean && tsc --declaration", - "clean": "rimraf *.js *.d.ts .nyc_output build coverage doc", + "build": "yarn clean && yarn build:es6 && yarn build:bundle", + "build:es6": "tsc --declaration", + "build:bundle": "../../scripts/bundle-module transducersHdom hdom hiccup transducers", + "test": "rimraf build && tsc -p test/tsconfig.json && nyc mocha build/test/*.js", + "clean": "rimraf *.js *.d.ts .nyc_output build coverage doc lib", "cover": "yarn test && nyc report --reporter=lcov", "doc": "node_modules/.bin/typedoc --mode modules --out doc src", - "pub": "yarn build && yarn publish --access public", - "test": "rimraf build && tsc -p test && nyc mocha build/test/*.js" + "pub": "yarn build && yarn publish --access public" }, "devDependencies": { "@types/mocha": "^5.2.5", @@ -28,8 +32,8 @@ "typescript": "^3.2.2" }, "dependencies": { - "@thi.ng/checks": "^1.5.14", "@thi.ng/hdom": "^6.1.0", + "@thi.ng/hiccup": "^2.7.2", "@thi.ng/transducers": "^2.3.2" }, "keywords": [ @@ -44,5 +48,6 @@ ], "publishConfig": { "access": "public" - } + }, + "sideEffects": false } \ No newline at end of file diff --git a/packages/transducers-hdom/src/index.ts b/packages/transducers-hdom/src/index.ts index 58a1c03194..2174571045 100644 --- a/packages/transducers-hdom/src/index.ts +++ b/packages/transducers-hdom/src/index.ts @@ -1,9 +1,11 @@ -import { HDOMImplementation, HDOMOpts } from "@thi.ng/hdom/api"; -import { DEFAULT_IMPL } from "@thi.ng/hdom/default"; -import { resolveRoot } from "@thi.ng/hdom/utils"; -import { derefContext } from "@thi.ng/hiccup/deref"; -import { Transducer } from "@thi.ng/transducers/api"; -import { scan } from "@thi.ng/transducers/xform/scan"; +import { + DEFAULT_IMPL, + HDOMImplementation, + HDOMOpts, + resolveRoot +} from "@thi.ng/hdom"; +import { derefContext } from "@thi.ng/hiccup"; +import { scan, Transducer } from "@thi.ng/transducers"; /** * Side-effecting & stateful transducer which receives @thi.ng/hdom diff --git a/scripts/bundle-module b/scripts/bundle-module index cd259fe86d..2c2890eee5 100755 --- a/scripts/bundle-module +++ b/scripts/bundle-module @@ -4,10 +4,16 @@ const rollup = require("rollup"); const terser = require("terser"); const gz = require("gzip-size"); +const camelCase = + (x) => x.replace(/\-+(\w)/g, (_, c) => c.toUpperCase()); + +const size = + (x) => (x / 1024).toFixed(2) + "KB"; + const name = process.argv[2]; const deps = process.argv.slice(3).reduce( - (acc, x) => (acc[`@thi.ng/${x}`] = `thi.ng.${x}`, acc), + (acc, x) => (acc[`@thi.ng/${x}`] = `thi.ng.${camelCase(x)}`, acc), {} ); @@ -22,8 +28,6 @@ const terserOpts = { ecma: 6 }; -const size = (x) => (x / 1024).toFixed(2) + "KB"; - const buildVersion = async (dest, outOpts) => { console.log(`bundling (${outOpts.format}): ${dest}`); const bundle = await rollup.rollup(inOpts); @@ -33,12 +37,10 @@ const buildVersion = async (dest, outOpts) => { console.log(`\tsize: ${size(terserOut.code.length)} / gzipped: ${size(gz.sync(terserOut.code))}`); }; -if (!fs.existsSync("lib")) { - fs.mkdirSync("lib"); -} - const build = async () => { + !fs.existsSync("lib") && fs.mkdirSync("lib"); + await buildVersion( "lib/index.js", {