From b752510b5074fbc9a606e4d189412798c241f414 Mon Sep 17 00:00:00 2001 From: Gordon Smith Date: Fri, 13 Sep 2024 14:42:34 +0100 Subject: [PATCH] feat: Switch to esbuild and ESM first packaging Changed type to "module" and dropped UMD support Signed-off-by: Gordon Smith --- .gitignore | 1 + apps/angular-13/package.json | 2 +- apps/legacyDash/package.json | 2 +- apps/react-widget/package.json | 2 +- components/observable/package.json | 2 +- demos/dashy/tsconfig.json | 3 - demos/quickstart/amd_npm/package.json | 2 +- demos/quickstart/iife_npm/package.json | 2 +- demos/quickstart/rollup/package.json | 2 +- demos/quickstart/webpack/package.json | 2 +- demos/react/typescript/package.json | 4 +- demos/storyboard/tsconfig.json | 3 - package-lock.json | 993 ++++++++++++++---- package.json | 42 +- packages/chart/tsconfig.json | 3 - packages/common/tsconfig.json | 5 - packages/comms/package.json | 4 +- packages/comms/tsconfig.json | 6 +- packages/dataflow/.vscode/launch.json | 93 +- packages/dataflow/.vscode/tasks.json | 34 +- packages/dataflow/esbuild.js | 9 + packages/dataflow/package.json | 62 +- packages/dataflow/rollup-test.config.mjs | 32 - packages/dataflow/rollup.config.mjs | 32 - .../dataflow/{src/__tests__ => spec}/chain.ts | 5 +- .../{src/__tests__ => spec}/concat.ts | 2 +- .../dataflow/{src/__tests__ => spec}/count.ts | 4 +- .../dataflow/{src/__tests__ => spec}/data.ts | 2 +- .../{src/__tests__ => spec}/deviation.ts | 2 +- .../{src/__tests__ => spec}/distribution.ts | 2 +- .../dataflow/{src/__tests__ => spec}/each.ts | 4 +- .../{src/__tests__ => spec}/entries.ts | 2 +- .../{src/__tests__ => spec}/extent.ts | 4 +- .../{src/__tests__ => spec}/filter.ts | 4 +- .../dataflow/{src/__tests__ => spec}/first.ts | 2 +- .../{src/__tests__ => spec}/generate.ts | 2 +- .../dataflow/{src/__tests__ => spec}/group.ts | 4 +- .../{src/__tests__ => spec}/histogram.ts | 4 +- packages/dataflow/spec/index.browser.ts | 3 + packages/dataflow/spec/index.node.ts | 1 + packages/dataflow/spec/index.ts | 27 + .../dataflow/{src/__tests__ => spec}/join.ts | 4 +- .../dataflow/{src/__tests__ => spec}/map.ts | 4 +- .../dataflow/{src/__tests__ => spec}/max.ts | 4 +- .../dataflow/{src/__tests__ => spec}/mean.ts | 2 +- .../{src/__tests__ => spec}/median.ts | 2 +- .../dataflow/{src/__tests__ => spec}/min.ts | 4 +- .../{src/__tests__ => spec}/normalize.ts | 2 +- .../{src/__tests__ => spec}/quartile.ts | 2 +- .../{src/__tests__ => spec}/readme.ts | 2 +- .../{src/__tests__ => spec}/reduce.ts | 2 +- .../dataflow/{src/__tests__ => spec}/skip.ts | 2 +- .../dataflow/{src/__tests__ => spec}/sort.ts | 4 +- .../dataflow/spec/support/jasmine-browser.mjs | 28 + packages/dataflow/spec/support/jasmine.json | 10 + .../{src/__tests__ => spec}/variance.ts | 2 +- packages/dataflow/src/__tests__/index.ts | 27 - packages/dataflow/src/activities/concat.ts | 2 +- packages/dataflow/src/activities/each.ts | 2 +- packages/dataflow/src/activities/entries.ts | 2 +- packages/dataflow/src/activities/filter.ts | 2 +- packages/dataflow/src/activities/first.ts | 2 +- packages/dataflow/src/activities/group.ts | 2 +- packages/dataflow/src/activities/histogram.ts | 6 +- packages/dataflow/src/activities/join.ts | 2 +- packages/dataflow/src/activities/map.ts | 2 +- packages/dataflow/src/activities/normalize.ts | 8 +- packages/dataflow/src/activities/skip.ts | 2 +- packages/dataflow/src/activities/sort.ts | 2 +- packages/dataflow/src/index.ts | 54 +- packages/dataflow/src/observers/count.ts | 2 +- packages/dataflow/src/observers/deviation.ts | 4 +- .../dataflow/src/observers/distribution.ts | 10 +- packages/dataflow/src/observers/extent.ts | 6 +- packages/dataflow/src/observers/max.ts | 2 +- packages/dataflow/src/observers/mean.ts | 2 +- packages/dataflow/src/observers/median.ts | 2 +- packages/dataflow/src/observers/min.ts | 2 +- packages/dataflow/src/observers/observer.ts | 4 +- packages/dataflow/src/observers/quartile.ts | 4 +- packages/dataflow/src/observers/reduce.ts | 2 +- packages/dataflow/src/observers/variance.ts | 2 +- packages/dataflow/src/utils/pipe.ts | 6 +- packages/dataflow/tsconfig.json | 27 +- packages/dataflow/tsconfig.spec.json | 16 + packages/dgrid/tsconfig.json | 3 - packages/dgrid2/tsconfig.json | 3 - packages/eclwatch/tsconfig.json | 3 - packages/esbuild-plugins/package.json | 5 +- packages/esbuild-plugins/src/build.ts | 21 +- packages/graph/tsconfig.json | 3 - packages/html/tsconfig.json | 3 - packages/loader/tsconfig.json | 3 - packages/map/util/package.json | 2 +- packages/marshaller/tsconfig.json | 5 +- packages/observable-shim/.vscode/launch.json | 40 +- packages/observable-shim/.vscode/tasks.json | 34 +- packages/observable-shim/esbuild.js | 9 + packages/observable-shim/package.json | 49 +- packages/observable-shim/rollup.config.mjs | 46 - .../observable-shim/spec/index.browser.ts | 3 + packages/observable-shim/spec/index.node.ts | 1 + packages/observable-shim/spec/index.ts | 7 + .../spec/support/jasmine-browser.mjs | 28 + .../observable-shim/spec/support/jasmine.json | 10 + packages/observable-shim/src/index.ts | 4 +- packages/observable-shim/src/parse.ts | 46 +- packages/observable-shim/tsconfig.json | 28 +- packages/observable-shim/tsconfig.spec.json | 16 + .../observablehq-compiler/.vscode/launch.json | 66 +- .../observablehq-compiler/.vscode/tasks.json | 28 +- packages/observablehq-compiler/bin/ojscc.mjs | 32 +- packages/observablehq-compiler/esbuild.js | 9 + packages/observablehq-compiler/index.html | 31 +- packages/observablehq-compiler/package.json | 87 +- .../observablehq-compiler/rollup.config.mjs | 62 -- .../__tests__ => spec}/File Attachments.ts | 0 .../Introduction to Imports.ts | 0 .../Observable TimeChart.ts | 0 .../observablehq-compiler/spec/browser.ts | 193 ++++ .../spec/index.browser.ts | 4 + .../observablehq-compiler/spec/index.node.ts | 2 + packages/observablehq-compiler/spec/index.ts | 25 + packages/observablehq-compiler/spec/m1.mjs | 5 + packages/observablehq-compiler/spec/m2.mjs | 3 + packages/observablehq-compiler/spec/node.ts | 12 + .../spec/support/jasmine-browser.mjs | 28 + .../spec/support/jasmine.json | 10 + .../src/__tests__/index.ts | 13 - .../src/__tests__/m1.mjs | 3 - .../src/__tests__/node.ts | 199 ---- .../observablehq-compiler/src/compiler.ts | 54 +- packages/observablehq-compiler/src/cst.ts | 50 +- packages/observablehq-compiler/src/index.ts | 5 +- packages/observablehq-compiler/src/util.ts | 5 +- packages/observablehq-compiler/src/writer.ts | 13 +- packages/observablehq-compiler/tsconfig.json | 26 +- .../observablehq-compiler/tsconfig.spec.json | 16 + packages/phosphor/tsconfig.json | 3 - packages/util/.vscode/launch.json | 33 + packages/util/.vscode/tasks.json | 28 +- packages/util/esbuild.js | 9 + packages/util/package.json | 57 +- packages/util/rollup.config.mjs | 32 - .../util/spec/array.ts | 0 .../util/spec/cache.ts | 4 +- .../util/spec/debounce.ts | 10 +- .../util/spec/dictionary.ts | 0 .../src => packages/util/spec}/dts-bundle.ts | 0 .../esp.spec.ts => packages/util/spec/esp.ts | 0 .../util/spec/graph.ts | 0 .../util/spec/graph2.ts | 0 packages/util/spec/index.browser.ts | 3 + packages/util/spec/index.node.ts | 1 + packages/util/spec/index.ts | 16 + .../util/spec/logging.ts | 0 .../util/spec/math.ts | 0 .../util/spec/object.ts | 0 .../util/spec/observer.ts | 44 +- .../util/spec/platform.ts | 0 .../util/spec/stack.ts | 0 .../util/spec/stateful.ts | 0 .../util/spec/string.ts | 0 .../util/spec/support/jasmine-browser.mjs | 28 + packages/util/spec/support/jasmine.json | 10 + .../util/spec/types.ts | 8 +- .../url.spec.ts => packages/util/spec/url.ts | 0 .../util/spec/xmldom.ts | 4 + packages/util/src/array.ts | 3 +- packages/util/src/cache.ts | 2 +- packages/util/src/debounce.ts | 8 +- packages/util/src/dispatch.ts | 10 +- packages/util/src/graph2.ts | 2 +- packages/util/src/index.ts | 42 +- packages/util/src/logging.ts | 4 +- packages/util/src/saxParser.ts | 8 +- packages/util/src/stateful.ts | 8 +- packages/util/src/url.ts | 2 +- packages/util/tsconfig.json | 24 +- packages/util/tsconfig.spec.json | 16 + tests/test-util/.vscode/launch.json | 58 - tests/test-util/.vscode/tasks.json | 49 - tests/test-util/CHANGELOG.md | 406 ------- tests/test-util/karma.conf.js | 14 - tests/test-util/package.json | 28 - tests/test-util/src/index.node.spec.ts | 3 - tests/test-util/src/index.spec.ts | 16 - tests/test-util/test.html | 24 - tests/test-util/tsconfig.json | 27 - tests/test-util/webpack.config.cjs | 10 - utils/data/package.json | 2 +- website/package.json | 2 +- 192 files changed, 2074 insertions(+), 2033 deletions(-) create mode 100644 packages/dataflow/esbuild.js delete mode 100644 packages/dataflow/rollup-test.config.mjs delete mode 100644 packages/dataflow/rollup.config.mjs rename packages/dataflow/{src/__tests__ => spec}/chain.ts (93%) rename packages/dataflow/{src/__tests__ => spec}/concat.ts (94%) rename packages/dataflow/{src/__tests__ => spec}/count.ts (84%) rename packages/dataflow/{src/__tests__ => spec}/data.ts (98%) rename packages/dataflow/{src/__tests__ => spec}/deviation.ts (87%) rename packages/dataflow/{src/__tests__ => spec}/distribution.ts (89%) rename packages/dataflow/{src/__tests__ => spec}/each.ts (78%) rename packages/dataflow/{src/__tests__ => spec}/entries.ts (90%) rename packages/dataflow/{src/__tests__ => spec}/extent.ts (85%) rename packages/dataflow/{src/__tests__ => spec}/filter.ts (82%) rename packages/dataflow/{src/__tests__ => spec}/first.ts (91%) rename packages/dataflow/{src/__tests__ => spec}/generate.ts (78%) rename packages/dataflow/{src/__tests__ => spec}/group.ts (85%) rename packages/dataflow/{src/__tests__ => spec}/histogram.ts (93%) create mode 100644 packages/dataflow/spec/index.browser.ts create mode 100644 packages/dataflow/spec/index.node.ts create mode 100644 packages/dataflow/spec/index.ts rename packages/dataflow/{src/__tests__ => spec}/join.ts (85%) rename packages/dataflow/{src/__tests__ => spec}/map.ts (81%) rename packages/dataflow/{src/__tests__ => spec}/max.ts (90%) rename packages/dataflow/{src/__tests__ => spec}/mean.ts (82%) rename packages/dataflow/{src/__tests__ => spec}/median.ts (89%) rename packages/dataflow/{src/__tests__ => spec}/min.ts (90%) rename packages/dataflow/{src/__tests__ => spec}/normalize.ts (90%) rename packages/dataflow/{src/__tests__ => spec}/quartile.ts (90%) rename packages/dataflow/{src/__tests__ => spec}/readme.ts (99%) rename packages/dataflow/{src/__tests__ => spec}/reduce.ts (90%) rename packages/dataflow/{src/__tests__ => spec}/skip.ts (91%) rename packages/dataflow/{src/__tests__ => spec}/sort.ts (85%) create mode 100644 packages/dataflow/spec/support/jasmine-browser.mjs create mode 100644 packages/dataflow/spec/support/jasmine.json rename packages/dataflow/{src/__tests__ => spec}/variance.ts (87%) delete mode 100644 packages/dataflow/src/__tests__/index.ts create mode 100644 packages/dataflow/tsconfig.spec.json create mode 100644 packages/observable-shim/esbuild.js delete mode 100644 packages/observable-shim/rollup.config.mjs create mode 100644 packages/observable-shim/spec/index.browser.ts create mode 100644 packages/observable-shim/spec/index.node.ts create mode 100644 packages/observable-shim/spec/index.ts create mode 100644 packages/observable-shim/spec/support/jasmine-browser.mjs create mode 100644 packages/observable-shim/spec/support/jasmine.json create mode 100644 packages/observable-shim/tsconfig.spec.json create mode 100644 packages/observablehq-compiler/esbuild.js delete mode 100644 packages/observablehq-compiler/rollup.config.mjs rename packages/observablehq-compiler/{src/__tests__ => spec}/File Attachments.ts (100%) rename packages/observablehq-compiler/{src/__tests__ => spec}/Introduction to Imports.ts (100%) rename packages/observablehq-compiler/{src/__tests__ => spec}/Observable TimeChart.ts (100%) create mode 100644 packages/observablehq-compiler/spec/browser.ts create mode 100644 packages/observablehq-compiler/spec/index.browser.ts create mode 100644 packages/observablehq-compiler/spec/index.node.ts create mode 100644 packages/observablehq-compiler/spec/index.ts create mode 100644 packages/observablehq-compiler/spec/m1.mjs create mode 100644 packages/observablehq-compiler/spec/m2.mjs create mode 100644 packages/observablehq-compiler/spec/node.ts create mode 100644 packages/observablehq-compiler/spec/support/jasmine-browser.mjs create mode 100644 packages/observablehq-compiler/spec/support/jasmine.json delete mode 100644 packages/observablehq-compiler/src/__tests__/index.ts delete mode 100644 packages/observablehq-compiler/src/__tests__/m1.mjs delete mode 100644 packages/observablehq-compiler/src/__tests__/node.ts create mode 100644 packages/observablehq-compiler/tsconfig.spec.json create mode 100644 packages/util/.vscode/launch.json create mode 100644 packages/util/esbuild.js delete mode 100644 packages/util/rollup.config.mjs rename tests/test-util/src/array.spec.ts => packages/util/spec/array.ts (100%) rename tests/test-util/src/cache.spec.ts => packages/util/spec/cache.ts (97%) rename tests/test-util/src/debounce.spec.ts => packages/util/spec/debounce.ts (95%) rename tests/test-util/src/dictionary.spec.ts => packages/util/spec/dictionary.ts (100%) rename {tests/test-util/src => packages/util/spec}/dts-bundle.ts (100%) rename tests/test-util/src/esp.spec.ts => packages/util/spec/esp.ts (100%) rename tests/test-util/src/graph.spec.ts => packages/util/spec/graph.ts (100%) rename tests/test-util/src/graph2.spec.ts => packages/util/spec/graph2.ts (100%) create mode 100644 packages/util/spec/index.browser.ts create mode 100644 packages/util/spec/index.node.ts create mode 100644 packages/util/spec/index.ts rename tests/test-util/src/logging.spec.ts => packages/util/spec/logging.ts (100%) rename tests/test-util/src/math.spec.ts => packages/util/spec/math.ts (100%) rename tests/test-util/src/object.spec.ts => packages/util/spec/object.ts (100%) rename tests/test-util/src/observer.spec.ts => packages/util/spec/observer.ts (84%) rename tests/test-util/src/platform.spec.ts => packages/util/spec/platform.ts (100%) rename tests/test-util/src/stack.spec.ts => packages/util/spec/stack.ts (100%) rename tests/test-util/src/stateful.spec.ts => packages/util/spec/stateful.ts (100%) rename tests/test-util/src/string.spec.ts => packages/util/spec/string.ts (100%) create mode 100644 packages/util/spec/support/jasmine-browser.mjs create mode 100644 packages/util/spec/support/jasmine.json rename tests/test-util/src/types.spec.ts => packages/util/spec/types.ts (92%) rename tests/test-util/src/url.spec.ts => packages/util/spec/url.ts (100%) rename tests/test-util/src/xmldom.spec.ts => packages/util/spec/xmldom.ts (97%) create mode 100644 packages/util/tsconfig.spec.json delete mode 100644 tests/test-util/.vscode/launch.json delete mode 100644 tests/test-util/.vscode/tasks.json delete mode 100644 tests/test-util/CHANGELOG.md delete mode 100644 tests/test-util/karma.conf.js delete mode 100644 tests/test-util/package.json delete mode 100644 tests/test-util/src/index.node.spec.ts delete mode 100644 tests/test-util/src/index.spec.ts delete mode 100644 tests/test-util/test.html delete mode 100644 tests/test-util/tsconfig.json delete mode 100644 tests/test-util/webpack.config.cjs diff --git a/.gitignore b/.gitignore index 2c93d8d066..1cb380b2ba 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ .nx node_modules dist/ +dist-test/ build/ lib*/ !demos/storyboard/lib-umd/ diff --git a/apps/angular-13/package.json b/apps/angular-13/package.json index 01517abb18..e25fce8cf5 100644 --- a/apps/angular-13/package.json +++ b/apps/angular-13/package.json @@ -7,7 +7,7 @@ "start-prod": "npx http-server -p 8080 ./dist/angular-13/ -o index.html", "build": "ng build", "watch": "ng build --watch --configuration development", - "test": "ng test", + "test-old": "ng test", "update": "npx --yes npm-check-updates -u -t minor" }, "private": true, diff --git a/apps/legacyDash/package.json b/apps/legacyDash/package.json index 9e0bc1b8aa..b64ccabf32 100644 --- a/apps/legacyDash/package.json +++ b/apps/legacyDash/package.json @@ -2,7 +2,7 @@ "private": true, "name": "@hpcc-js/legacydash", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "test-old": "echo \"Error: no test specified\" && exit 1" }, "dependencies": { "@hpcc-js/codemirror": "0.0.74", diff --git a/apps/react-widget/package.json b/apps/react-widget/package.json index 90409513ee..4c6eb2221d 100644 --- a/apps/react-widget/package.json +++ b/apps/react-widget/package.json @@ -26,7 +26,7 @@ "build": "npx --yes react-scripts build", "eject": "npx react-scripts eject", "start": "npm run clean && npx react-scripts start", - "test": "npx react-scripts test", + "test-old": "npx react-scripts test", "update": "npx --yes npm-check-updates -u -t minor", "update-major": "npx --yes npm-check-updates -u" }, diff --git a/components/observable/package.json b/components/observable/package.json index 8a159cd07e..47f56ba2e5 100644 --- a/components/observable/package.json +++ b/components/observable/package.json @@ -47,4 +47,4 @@ "url": "https://github.com/hpcc-systems/Visualization/issues" }, "homepage": "https://github.com/hpcc-systems/Visualization#readme" -} +} \ No newline at end of file diff --git a/demos/dashy/tsconfig.json b/demos/dashy/tsconfig.json index a390f00539..b366f43ec9 100644 --- a/demos/dashy/tsconfig.json +++ b/demos/dashy/tsconfig.json @@ -41,9 +41,6 @@ }, { "path": "../../packages/react/" - }, - { - "path": "../../packages/util/" } ] } \ No newline at end of file diff --git a/demos/quickstart/amd_npm/package.json b/demos/quickstart/amd_npm/package.json index e20b24ccb2..d7795d25c0 100644 --- a/demos/quickstart/amd_npm/package.json +++ b/demos/quickstart/amd_npm/package.json @@ -4,7 +4,7 @@ "description": "", "main": "index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", + "test-old": "echo \"Error: no test specified\" && exit 1", "update": "npx --yes npm-check-updates -u -t minor" }, "dependencies": { diff --git a/demos/quickstart/iife_npm/package.json b/demos/quickstart/iife_npm/package.json index 7ea84a293a..b56ec3c6d6 100644 --- a/demos/quickstart/iife_npm/package.json +++ b/demos/quickstart/iife_npm/package.json @@ -4,7 +4,7 @@ "description": "", "main": "index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", + "test-old": "echo \"Error: no test specified\" && exit 1", "update": "npx --yes npm-check-updates -u -t minor" }, "dependencies": { diff --git a/demos/quickstart/rollup/package.json b/demos/quickstart/rollup/package.json index d0c6c0f1bc..cbb7c4fef4 100644 --- a/demos/quickstart/rollup/package.json +++ b/demos/quickstart/rollup/package.json @@ -8,7 +8,7 @@ "bundle-watch": "rollup -c -w", "minimize": "terser dist/index.js -c -m -o dist/index.min.js", "build": "npm run bundle && npm run minimize", - "test": "echo \"Error: no test specified\" && exit 1", + "test-old": "echo \"Error: no test specified\" && exit 1", "update": "npx --yes npm-check-updates -u -t minor" }, "dependencies": { diff --git a/demos/quickstart/webpack/package.json b/demos/quickstart/webpack/package.json index efc5968a26..1a3b322dcb 100644 --- a/demos/quickstart/webpack/package.json +++ b/demos/quickstart/webpack/package.json @@ -5,7 +5,7 @@ "main": "dist/index.js", "scripts": { "build": "webpack", - "test": "echo \"Error: no test specified\" && exit 1", + "test-old": "echo \"Error: no test specified\" && exit 1", "update": "npx --yes npm-check-updates -u -t minor" }, "dependencies": { diff --git a/demos/react/typescript/package.json b/demos/react/typescript/package.json index 071441e826..14a0e06dae 100644 --- a/demos/react/typescript/package.json +++ b/demos/react/typescript/package.json @@ -24,7 +24,7 @@ "build": "npx --yes react-scripts build", "eject": "npx react-scripts eject", "start": "npm run clean && npx react-scripts start", - "test": "npx react-scripts test", + "test-old": "npx react-scripts test", "update": "npx --yes npm-check-updates -u -t minor" }, "eslintConfig": { @@ -45,4 +45,4 @@ "last 1 safari version" ] } -} +} \ No newline at end of file diff --git a/demos/storyboard/tsconfig.json b/demos/storyboard/tsconfig.json index 340a9a0dc8..f8f12d33e7 100644 --- a/demos/storyboard/tsconfig.json +++ b/demos/storyboard/tsconfig.json @@ -37,9 +37,6 @@ }, { "path": "../../packages/other/" - }, - { - "path": "../../packages/util/" } ] } \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 55291c8761..857670ddac 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,42 +10,7 @@ "license": "Apache-2.0", "workspaces": [ "utils/*", - "packages/api", - "packages/bundle", - "packages/chart", - "packages/codemirror", - "packages/codemirror-shim", - "packages/common", - "packages/comms", - "packages/composite", - "packages/dataflow", - "packages/ddl-shim", - "packages/deck-shim", - "packages/dgrid", - "packages/dgrid-shim", - "packages/dgrid2", - "packages/eclwatch", - "packages/esbuild-plugins", - "packages/form", - "packages/graph", - "packages/html", - "packages/layout", - "packages/leaflet-shim", - "packages/loader", - "packages/map", - "packages/map-deck", - "packages/marshaller", - "packages/observable-shim", - "packages/observablehq-compiler", - "packages/other", - "packages/phosphor", - "packages/phosphor-shim", - "packages/preact-shim", - "packages/react", - "packages/requirejs-shim", - "packages/timeline", - "packages/tree", - "packages/util", + "packages/*", "components/*", "demos/dashy", "demos/dermatology", @@ -84,6 +49,9 @@ "esbuild-plugin-umd-wrapper": "3.0.0", "eslint": "8.57.0", "eslint-plugin-react-hooks": "4.6.2", + "jasmine": "^5.3.0", + "jasmine-browser-runner": "^2.5.0", + "jasmine-core": "^5.3.0", "lerna": "8.1.5", "local-web-server": "5.3.3", "mocha": "10.5.2", @@ -1019,6 +987,13 @@ "node": ">=6.9.0" } }, + "node_modules/@bazel/runfiles": { + "version": "5.8.1", + "resolved": "https://registry.npmjs.org/@bazel/runfiles/-/runfiles-5.8.1.tgz", + "integrity": "sha512-NDdfpdQ6rZlylgv++iMn5FkObC/QlBQvipinGLSOguTYpRywmieOyJ29XHvUilspwTFSILWpoE9CqMGkHXug1g==", + "dev": true, + "license": "Apache-2.0" + }, "node_modules/@codemirror/autocomplete": { "version": "6.16.3", "resolved": "https://registry.npmjs.org/@codemirror/autocomplete/-/autocomplete-6.16.3.tgz", @@ -1961,6 +1936,10 @@ "resolved": "packages/marshaller", "link": true }, + "node_modules/@hpcc-js/observable-md": { + "resolved": "packages/observable-md", + "link": true + }, "node_modules/@hpcc-js/observable-shim": { "resolved": "packages/observable-shim", "link": true @@ -2065,10 +2044,6 @@ "resolved": "tests/test-unpkg", "link": true }, - "node_modules/@hpcc-js/test-util": { - "resolved": "tests/test-util", - "link": true - }, "node_modules/@hpcc-js/timeline": { "resolved": "packages/timeline", "link": true @@ -5715,17 +5690,6 @@ "integrity": "sha512-WCfD5Ht3ZesJUsONdhvm84dmzWOiOzOAqOncN0++w0lBw1o8OuDNJF2McvvCef/yBqb/HYRahp1BYtODFQ8bRg==", "license": "MIT" }, - "node_modules/@types/glob": { - "version": "5.0.38", - "resolved": "https://registry.npmjs.org/@types/glob/-/glob-5.0.38.tgz", - "integrity": "sha512-rTtf75rwyP9G2qO5yRpYtdJ6aU1QqEhWbtW55qEgquEDa6bXW0s2TWZfDm02GuppjEozOWG/F2UnPq5hAQb+gw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/minimatch": "*", - "@types/node": "*" - } - }, "node_modules/@types/hammerjs": { "version": "2.0.45", "resolved": "https://registry.npmjs.org/@types/hammerjs/-/hammerjs-2.0.45.tgz", @@ -5739,6 +5703,13 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/jasmine": { + "version": "5.1.4", + "resolved": "https://registry.npmjs.org/@types/jasmine/-/jasmine-5.1.4.tgz", + "integrity": "sha512-px7OMFO/ncXxixDe1zR13V1iycqWae0MxTaw62RpFlksUi5QuNWgQJFkTQjIOvrmutJbI7Fp2Y2N1F6D2R4G6w==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/jest": { "version": "27.5.2", "resolved": "https://registry.npmjs.org/@types/jest/-/jest-27.5.2.tgz", @@ -5845,16 +5816,6 @@ "dev": true, "license": "MIT" }, - "node_modules/@types/mkdirp": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@types/mkdirp/-/mkdirp-1.0.2.tgz", - "integrity": "sha512-o0K1tSO0Dx5X6xlU5F1D6625FawhC3dU3iqr25lluNv/+/QIVH8RLNEiVokgIZo+mz+87w/3Mkg/VvQS+J51fQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/mocha": { "version": "10.0.7", "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.7.tgz", @@ -7190,6 +7151,13 @@ "node": ">=8" } }, + "node_modules/array-flatten": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==", + "dev": true, + "license": "MIT" + }, "node_modules/array-ify": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/array-ify/-/array-ify-1.0.0.tgz", @@ -7519,6 +7487,88 @@ "readable-stream": "^3.4.0" } }, + "node_modules/body-parser": { + "version": "1.20.3", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.3.tgz", + "integrity": "sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g==", + "dev": true, + "license": "MIT", + "dependencies": { + "bytes": "3.1.2", + "content-type": "~1.0.5", + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "on-finished": "2.4.1", + "qs": "6.13.0", + "raw-body": "2.5.2", + "type-is": "~1.6.18", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" + } + }, + "node_modules/body-parser/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/body-parser/node_modules/http-errors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/body-parser/node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/body-parser/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true, + "license": "MIT" + }, + "node_modules/body-parser/node_modules/statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/boolbase": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", @@ -8880,6 +8930,13 @@ "node": ">=14" } }, + "node_modules/cookie-signature": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", + "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==", + "dev": true, + "license": "MIT" + }, "node_modules/cookies": { "version": "0.9.1", "resolved": "https://registry.npmjs.org/cookies/-/cookies-0.9.1.tgz", @@ -10239,15 +10296,6 @@ "node": ">=8" } }, - "node_modules/data-uri-to-buffer": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz", - "integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==", - "license": "MIT", - "engines": { - "node": ">= 12" - } - }, "node_modules/data-view-buffer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.1.tgz", @@ -12070,6 +12118,139 @@ "dev": true, "license": "Apache-2.0" }, + "node_modules/express": { + "version": "4.21.0", + "resolved": "https://registry.npmjs.org/express/-/express-4.21.0.tgz", + "integrity": "sha512-VqcNGcj/Id5ZT1LZ/cfihi3ttTn+NJmkli2eZADigjq29qTlWi/hAQ43t/VLPq8+UX06FCEx3ByOYet6ZFblng==", + "dev": true, + "license": "MIT", + "dependencies": { + "accepts": "~1.3.8", + "array-flatten": "1.1.1", + "body-parser": "1.20.3", + "content-disposition": "0.5.4", + "content-type": "~1.0.4", + "cookie": "0.6.0", + "cookie-signature": "1.0.6", + "debug": "2.6.9", + "depd": "2.0.0", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "finalhandler": "1.3.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "merge-descriptors": "1.0.3", + "methods": "~1.1.2", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "path-to-regexp": "0.1.10", + "proxy-addr": "~2.0.7", + "qs": "6.13.0", + "range-parser": "~1.2.1", + "safe-buffer": "5.2.1", + "send": "0.19.0", + "serve-static": "1.16.2", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "type-is": "~1.6.18", + "utils-merge": "1.0.1", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.10.0" + } + }, + "node_modules/express/node_modules/cookie": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", + "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/express/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/express/node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/express/node_modules/finalhandler": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.1.tgz", + "integrity": "sha512-6BN9trH7bp3qvnrRyzsBz+g3lZxTNZTbVO2EV1CS0WIcDbawYVdYvGflME/9QP0h0pYlCDBCTjYa9nZzMDpyxQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "2.6.9", + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "on-finished": "2.4.1", + "parseurl": "~1.3.3", + "statuses": "2.0.1", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/express/node_modules/http-errors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/express/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true, + "license": "MIT" + }, + "node_modules/express/node_modules/path-to-regexp": { + "version": "0.1.10", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.10.tgz", + "integrity": "sha512-7lf7qcQidTku0Gu3YDPc8DJ1q7OOucfa/BSsIwjuh56VU7katFvuM8hULfkwB3Fns/rsVF7PwPKVw1sl5KQS9w==", + "dev": true, + "license": "MIT" + }, + "node_modules/express/node_modules/statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/external-editor": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", @@ -12255,29 +12436,6 @@ "pend": "~1.2.0" } }, - "node_modules/fetch-blob": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz", - "integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/jimmywarting" - }, - { - "type": "paypal", - "url": "https://paypal.me/jimmywarting" - } - ], - "license": "MIT", - "dependencies": { - "node-domexception": "^1.0.0", - "web-streams-polyfill": "^3.0.3" - }, - "engines": { - "node": "^12.20 || >= 14.13" - } - }, "node_modules/figures": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", @@ -12647,18 +12805,6 @@ "node": ">= 14.17" } }, - "node_modules/formdata-polyfill": { - "version": "4.0.10", - "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", - "integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==", - "license": "MIT", - "dependencies": { - "fetch-blob": "^3.1.2" - }, - "engines": { - "node": ">=12.20.0" - } - }, "node_modules/formidable": { "version": "3.5.1", "resolved": "https://registry.npmjs.org/formidable/-/formidable-3.5.1.tgz", @@ -12674,6 +12820,16 @@ "url": "https://ko-fi.com/tunnckoCore/commissions" } }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, "node_modules/fp-and-or": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/fp-and-or/-/fp-and-or-0.1.4.tgz", @@ -13792,6 +13948,13 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/immediate": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", + "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==", + "dev": true, + "license": "MIT" + }, "node_modules/import-cwd": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/import-cwd/-/import-cwd-3.0.0.tgz", @@ -14039,6 +14202,16 @@ "dev": true, "license": "BSD-3-Clause" }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, "node_modules/is-arguments": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", @@ -14711,39 +14884,173 @@ "node": ">=10" } }, - "node_modules/javascript-autocomplete": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/javascript-autocomplete/-/javascript-autocomplete-1.0.5.tgz", - "integrity": "sha512-AwR8g10tPIjhrxc5n9mNHCvtspQ0bBZCNia4tXu2gk6HrhD3auI2hQLzgm79yKMihLRkmfXZ8kEXTGcfOmx6OQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/jest-diff": { - "version": "29.7.0", - "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.7.0.tgz", - "integrity": "sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw==", + "node_modules/jasmine": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/jasmine/-/jasmine-5.3.0.tgz", + "integrity": "sha512-Vrv5VWTXVZ/5xcNawlYCmE24pOaZu3KduLr9iAaENoMJ8W8Ryvhfpw2cf3rI4Unc2ajvu2t4tCKjS72TnraBGQ==", "dev": true, "license": "MIT", "dependencies": { - "chalk": "^4.0.0", - "diff-sequences": "^29.6.3", - "jest-get-type": "^29.6.3", - "pretty-format": "^29.7.0" + "glob": "^10.2.2", + "jasmine-core": "~5.3.0" }, - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + "bin": { + "jasmine": "bin/jasmine.js" } }, - "node_modules/jest-get-type": { - "version": "29.6.3", - "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.6.3.tgz", - "integrity": "sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==", + "node_modules/jasmine-browser-runner": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/jasmine-browser-runner/-/jasmine-browser-runner-2.5.0.tgz", + "integrity": "sha512-CzdvpeZunUu6x1u8G6/vPnfcKVpDaBFfk3tIvm1hoA+EfceQ8FRvsy4o8hEcKYyMt556XFRnP5PjYsxFU8z7Xw==", "dev": true, "license": "MIT", - "engines": { - "node": "^14.15.0 || ^16.10.0 || >=18.0.0" - } - }, + "dependencies": { + "ejs": "^3.1.6", + "express": "^4.19.2", + "glob": "^10.0.0", + "selenium-webdriver": "^4.12.0" + }, + "bin": { + "jasmine-browser-runner": "bin/jasmine-browser-runner" + }, + "peerDependencies": { + "jasmine-core": "^5.0.0" + } + }, + "node_modules/jasmine-browser-runner/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/jasmine-browser-runner/node_modules/glob": { + "version": "10.4.5", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", + "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", + "dev": true, + "license": "ISC", + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/jasmine-browser-runner/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/jasmine-core": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-5.3.0.tgz", + "integrity": "sha512-zsOmeBKESky4toybvWEikRiZ0jHoBEu79wNArLfMdSnlLMZx3Xcp6CSm2sUcYyoJC+Uyj8LBJap/MUbVSfJ27g==", + "dev": true, + "license": "MIT" + }, + "node_modules/jasmine/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/jasmine/node_modules/glob": { + "version": "10.4.5", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", + "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", + "dev": true, + "license": "ISC", + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/jasmine/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/javascript-autocomplete": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/javascript-autocomplete/-/javascript-autocomplete-1.0.5.tgz", + "integrity": "sha512-AwR8g10tPIjhrxc5n9mNHCvtspQ0bBZCNia4tXu2gk6HrhD3auI2hQLzgm79yKMihLRkmfXZ8kEXTGcfOmx6OQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/jest-diff": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.7.0.tgz", + "integrity": "sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^4.0.0", + "diff-sequences": "^29.6.3", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-get-type": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.6.3.tgz", + "integrity": "sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, "node_modules/jest-matcher-utils": { "version": "27.5.1", "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-27.5.1.tgz", @@ -15042,6 +15349,59 @@ "node": "*" } }, + "node_modules/jszip": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.10.1.tgz", + "integrity": "sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g==", + "dev": true, + "license": "(MIT OR GPL-3.0-or-later)", + "dependencies": { + "lie": "~3.3.0", + "pako": "~1.0.2", + "readable-stream": "~2.3.6", + "setimmediate": "^1.0.5" + } + }, + "node_modules/jszip/node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/jszip/node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "dev": true, + "license": "MIT", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/jszip/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true, + "license": "MIT" + }, + "node_modules/jszip/node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, "node_modules/just-diff": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/just-diff/-/just-diff-6.0.2.tgz", @@ -15744,6 +16104,16 @@ "node": ">=8" } }, + "node_modules/lie": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz", + "integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "immediate": "~3.0.5" + } + }, "node_modules/lilconfig": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz", @@ -16634,6 +17004,16 @@ "node": ">=10" } }, + "node_modules/merge-descriptors": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz", + "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/merge-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", @@ -17475,43 +17855,6 @@ "dev": true, "license": "MIT" }, - "node_modules/node-domexception": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", - "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/jimmywarting" - }, - { - "type": "github", - "url": "https://paypal.me/jimmywarting" - } - ], - "license": "MIT", - "engines": { - "node": ">=10.5.0" - } - }, - "node_modules/node-fetch": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz", - "integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==", - "license": "MIT", - "dependencies": { - "data-uri-to-buffer": "^4.0.0", - "fetch-blob": "^3.1.4", - "formdata-polyfill": "^4.0.10" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/node-fetch" - } - }, "node_modules/node-gyp": { "version": "10.2.0", "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-10.2.0.tgz", @@ -19670,6 +20013,13 @@ "node": "^16.14.0 || >=18.0.0" } }, + "node_modules/pako": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", + "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==", + "dev": true, + "license": "(MIT AND Zlib)" + }, "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -20795,6 +21145,20 @@ "dev": true, "license": "MIT" }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "dev": true, + "license": "MIT", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, "node_modules/proxy-agent": { "version": "6.4.0", "resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-6.4.0.tgz", @@ -21086,6 +21450,16 @@ "safe-buffer": "^5.1.0" } }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, "node_modules/raw-body": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", @@ -22381,6 +22755,22 @@ "license": "MIT", "peer": true }, + "node_modules/selenium-webdriver": { + "version": "4.24.0", + "resolved": "https://registry.npmjs.org/selenium-webdriver/-/selenium-webdriver-4.24.0.tgz", + "integrity": "sha512-qrqoHhHPZuKLiz5VAQUxrn3ILs7/cYqn2/x96r35g5JjkLUjOS1lX+F+tEJKhRMlQ/MGJ+N1016JF5g2xZUFzw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@bazel/runfiles": "^5.8.1", + "jszip": "^3.10.1", + "tmp": "^0.2.3", + "ws": "^8.18.0" + }, + "engines": { + "node": ">= 14.21.0" + } + }, "node_modules/semver": { "version": "7.5.4", "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", @@ -22433,6 +22823,95 @@ "node": ">=10" } }, + "node_modules/send": { + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz", + "integrity": "sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "2.6.9", + "depd": "2.0.0", + "destroy": "1.2.0", + "encodeurl": "~1.0.2", + "escape-html": "~1.0.3", + "etag": "~1.8.1", + "fresh": "0.5.2", + "http-errors": "2.0.0", + "mime": "1.6.0", + "ms": "2.1.3", + "on-finished": "2.4.1", + "range-parser": "~1.2.1", + "statuses": "2.0.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/send/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/send/node_modules/debug/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true, + "license": "MIT" + }, + "node_modules/send/node_modules/http-errors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/send/node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "dev": true, + "license": "MIT", + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/send/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/send/node_modules/statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/serialize-javascript": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", @@ -22519,6 +22998,32 @@ "dev": true, "license": "ISC" }, + "node_modules/serve-static": { + "version": "1.16.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz", + "integrity": "sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==", + "dev": true, + "license": "MIT", + "dependencies": { + "encodeurl": "~2.0.0", + "escape-html": "~1.0.3", + "parseurl": "~1.3.3", + "send": "0.19.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/serve-static/node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/set-blocking": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", @@ -22560,6 +23065,13 @@ "node": ">= 0.4" } }, + "node_modules/setimmediate": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", + "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==", + "dev": true, + "license": "MIT" + }, "node_modules/setprototypeof": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", @@ -24519,6 +25031,16 @@ "dev": true, "license": "MIT" }, + "node_modules/utils-merge": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", + "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4.0" + } + }, "node_modules/uuid": { "version": "10.0.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-10.0.0.tgz", @@ -24773,15 +25295,6 @@ "defaults": "^1.0.3" } }, - "node_modules/web-streams-polyfill": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz", - "integrity": "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==", - "license": "MIT", - "engines": { - "node": ">= 8" - } - }, "node_modules/web-vitals": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/web-vitals/-/web-vitals-2.1.4.tgz", @@ -25879,9 +26392,9 @@ "version": "9.0.0", "license": "Apache-2.0", "devDependencies": { - "@hpcc-js/bundle": "^2.12.0", + "@hpcc-js/esbuild-plugins": "^1.1.2", "@types/faker": "4.1.12", - "@types/mocha": "10.0.7", + "@types/jasmine": "5.1.4", "faker": "4.1.0" } }, @@ -26315,12 +26828,110 @@ "node": ">=0.10.0" } }, + "packages/observable-md": { + "name": "@hpcc-js/observable-md", + "version": "2.54.19", + "license": "Apache-2.0", + "dependencies": { + "@hpcc-js/common": "^2.71.18", + "@hpcc-js/observable-shim": "^2.5.5", + "@hpcc-js/util": "^2.51.1" + }, + "devDependencies": { + "@hpcc-js/bundle": "^2.11.5", + "@observablehq/runtime": "4.28.0", + "d3-require": "^1", + "tslib": "2.6.2" + } + }, + "packages/observable-md/node_modules/@observablehq/inspector": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/@observablehq/inspector/-/inspector-3.2.4.tgz", + "integrity": "sha512-P1TdR95pvvNri0XV6X/R+s9XO70d8ozhOp2cMXEJ2zsiGzB8VjOdrJgRJyLjEJ0OJy7jP9VXFiC1Hej8WgsF5A==", + "dev": true, + "license": "ISC", + "dependencies": { + "isoformat": "^0.2.0" + } + }, + "packages/observable-md/node_modules/@observablehq/runtime": { + "version": "4.28.0", + "resolved": "https://registry.npmjs.org/@observablehq/runtime/-/runtime-4.28.0.tgz", + "integrity": "sha512-C4f/ha9dlt/9StGj0zW6SK5oZy/mA00O0h0hj1eWPdGFUtxbpRmQwDVi1/tgnD2qEkJkuZmuuQTYLph7GhBZPA==", + "dev": true, + "license": "ISC", + "dependencies": { + "@observablehq/inspector": "^3.2.2", + "@observablehq/stdlib": "^3.4.1" + } + }, + "packages/observable-md/node_modules/@observablehq/stdlib": { + "version": "3.24.0", + "resolved": "https://registry.npmjs.org/@observablehq/stdlib/-/stdlib-3.24.0.tgz", + "integrity": "sha512-SoaYrH/HgFf9kKww6oLQH5VBzhmTewtHytFMyt/6zPekLIWaBuy04gt7iXeSTuA+3L8yOvEQc7gS4DxMnj7+rA==", + "dev": true, + "license": "ISC", + "dependencies": { + "d3-dsv": "^2.0.0", + "d3-require": "^1.3.0" + } + }, + "packages/observable-md/node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "dev": true, + "license": "MIT" + }, + "packages/observable-md/node_modules/d3-dsv": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/d3-dsv/-/d3-dsv-2.0.0.tgz", + "integrity": "sha512-E+Pn8UJYx9mViuIUkoc93gJGGYut6mSDKy2+XaPwccwkRGlR+LO97L2VCCRjQivTwLHkSnAJG7yo00BWY6QM+w==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "commander": "2", + "iconv-lite": "0.4", + "rw": "1" + }, + "bin": { + "csv2json": "bin/dsv2json", + "csv2tsv": "bin/dsv2dsv", + "dsv2dsv": "bin/dsv2dsv", + "dsv2json": "bin/dsv2json", + "json2csv": "bin/json2dsv", + "json2dsv": "bin/json2dsv", + "json2tsv": "bin/json2dsv", + "tsv2csv": "bin/dsv2dsv", + "tsv2json": "bin/dsv2json" + } + }, + "packages/observable-md/node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "packages/observable-md/node_modules/tslib": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", + "dev": true, + "license": "0BSD" + }, "packages/observable-shim": { "name": "@hpcc-js/observable-shim", "version": "2.6.0", "license": "Apache-2.0", "devDependencies": { - "@hpcc-js/bundle": "^2.12.0", + "@hpcc-js/esbuild-plugins": "^1.1.2", "@observablehq/parser": "6.1.0" } }, @@ -26329,17 +26940,16 @@ "version": "1.3.0", "license": "Apache-2.0", "dependencies": { - "@hpcc-js/observable-shim": "^2.6.0", - "node-fetch": "3.3.2", "yargs": "17.7.2" }, "bin": { "ojscc": "bin/ojscc.mjs" }, "devDependencies": { - "@hpcc-js/bundle": "^2.12.0", + "@hpcc-js/esbuild-plugins": "^1.1.2", + "@hpcc-js/observable-shim": "^2.6.0", "@observablehq/runtime": "5.9.8", - "tslib": "2.6.3" + "@types/jasmine": "5.1.4" } }, "packages/observablehq-compiler/node_modules/yargs": { @@ -26505,11 +27115,9 @@ "name": "@hpcc-js/util", "version": "2.52.0", "license": "Apache-2.0", - "dependencies": { - "tslib": "2.6.3" - }, "devDependencies": { - "@hpcc-js/bundle": "^2.12.0" + "@hpcc-js/esbuild-plugins": "^1.1.2", + "@types/jasmine": "5.1.4" } }, "tests/test-chart": { @@ -26772,6 +27380,7 @@ }, "tests/test-util": { "name": "@hpcc-js/test-util", + "extraneous": true, "dependencies": { "@hpcc-js/util": "^2.51.0", "es6-promise": "4.2.8" @@ -26783,16 +27392,6 @@ "detect-indent": "7.0.1" } }, - "tests/test-util/node_modules/detect-indent": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-7.0.1.tgz", - "integrity": "sha512-Mc7QhQ8s+cLrnUfU/Ji94vG/r8M26m8f++vyres4ZoojaRDpZ1eSIh/EpzLNwlWuvzSZ3UbDFspjFvTDXe6e/g==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12.20" - } - }, "utils/bundle": { "name": "@hpcc-js/bundle", "version": "2.12.0", diff --git a/package.json b/package.json index bcc75db2d1..25ed25b5ff 100644 --- a/package.json +++ b/package.json @@ -6,42 +6,7 @@ "jsdelivr": "dist/index.umd.min.js", "workspaces": [ "utils/*", - "packages/api", - "packages/bundle", - "packages/chart", - "packages/codemirror", - "packages/codemirror-shim", - "packages/common", - "packages/comms", - "packages/composite", - "packages/dataflow", - "packages/ddl-shim", - "packages/deck-shim", - "packages/dgrid", - "packages/dgrid-shim", - "packages/dgrid2", - "packages/eclwatch", - "packages/esbuild-plugins", - "packages/form", - "packages/graph", - "packages/html", - "packages/layout", - "packages/leaflet-shim", - "packages/loader", - "packages/map", - "packages/map-deck", - "packages/marshaller", - "packages/observable-shim", - "packages/observablehq-compiler", - "packages/other", - "packages/phosphor", - "packages/phosphor-shim", - "packages/preact-shim", - "packages/react", - "packages/requirejs-shim", - "packages/timeline", - "packages/tree", - "packages/util", + "packages/*", "components/*", "demos/dashy", "demos/dermatology", @@ -88,7 +53,7 @@ "lint": "lerna run lint", "lint-all": "lerna run --no-bail lint -- --max-warnings=0", "lint-fix": "lerna run --no-bail lint -- --fix", - "test": "lerna run test --scope \"@hpcc-js/test-*\" --scope \"@hpcc-js/demo-gallery\"", + "test": "lerna run test --scope \"@hpcc-js/*\" --ignore \"@hpcc-js/test-*\" --ignore \"@hpcc-js/demo-*\"", "test:chrome": "lerna run test:chrome --scope \"@hpcc-js/test-*\"", "test:firefox": "lerna run test:firefox --scope \"@hpcc-js/test-*\"", "test:ie": "lerna run test:ie --scope \"@hpcc-js/test-*\"", @@ -142,6 +107,9 @@ "esbuild-plugin-umd-wrapper": "3.0.0", "eslint": "8.57.0", "eslint-plugin-react-hooks": "4.6.2", + "jasmine": "^5.3.0", + "jasmine-browser-runner": "^2.5.0", + "jasmine-core": "^5.3.0", "lerna": "8.1.5", "local-web-server": "5.3.3", "mocha": "10.5.2", diff --git a/packages/chart/tsconfig.json b/packages/chart/tsconfig.json index e672b6bfa5..8f9deacbde 100644 --- a/packages/chart/tsconfig.json +++ b/packages/chart/tsconfig.json @@ -16,8 +16,5 @@ { "path": "../common" }, - { - "path": "../util" - } ] } \ No newline at end of file diff --git a/packages/common/tsconfig.json b/packages/common/tsconfig.json index 2dd21e77ae..8c24216400 100644 --- a/packages/common/tsconfig.json +++ b/packages/common/tsconfig.json @@ -7,10 +7,5 @@ }, "include": [ "./src/**/*" - ], - "references": [ - { - "path": "../util" - } ] } \ No newline at end of file diff --git a/packages/comms/package.json b/packages/comms/package.json index 4eeffc238c..8a188e1fda 100644 --- a/packages/comms/package.json +++ b/packages/comms/package.json @@ -35,7 +35,7 @@ "stamp": "node ../../node_modules/@hpcc-js/bundle/src/stamp.js", "lint": "eslint ./src", "lint-fix": "eslint --fix src/**/*.ts", - "test": "mocha lib-umd/__tests__ --reporter spec", + "test-old": "mocha lib-umd/__tests__ --reporter spec", "docs": "typedoc --options tdoptions.json .", "update": "npx --yes npm-check-updates -u -t minor", "wsdl-access": "node ./lib-cjs/index.js -k --url=http://localhost:8010/ws_access?wsdl --outDir=./src/services/wsdl", @@ -95,4 +95,4 @@ "url": "https://github.com/hpcc-systems/Visualization/issues" }, "homepage": "https://github.com/hpcc-systems/Visualization" -} +} \ No newline at end of file diff --git a/packages/comms/tsconfig.json b/packages/comms/tsconfig.json index 3eb6c00591..39e2701fd9 100644 --- a/packages/comms/tsconfig.json +++ b/packages/comms/tsconfig.json @@ -13,9 +13,5 @@ "include": [ "./src/**/*" ], - "references": [ - { - "path": "../util" - } - ] + "references": [] } \ No newline at end of file diff --git a/packages/dataflow/.vscode/launch.json b/packages/dataflow/.vscode/launch.json index 01968f3244..3ee32e4122 100644 --- a/packages/dataflow/.vscode/launch.json +++ b/packages/dataflow/.vscode/launch.json @@ -1,100 +1,33 @@ { - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { - "name": "Debug Mocha Tests", + "name": "test-browser", + "type": "msedge", "request": "launch", - "runtimeArgs": [ - "test" - ], - "runtimeExecutable": "npm", - "skipFiles": [ - "/**" - ], - "type": "node" - }, - { - "name": "Mocha Tests (old)", - "args": [ - "-u", - "tdd", - "--timeout", - "999999", - "--colors", - "${workspaceFolder}/dist-test/index.js" - ], - "internalConsoleOptions": "openOnSessionStart", - "program": "${workspaceFolder}/../../node_modules/mocha/bin/_mocha", - "request": "launch", - "skipFiles": [ - "/**" + "url": "http://localhost:8888", + "webRoot": "${workspaceFolder}", + "outFiles": [ + "${workspaceFolder}/**/*.js", + "!**/node_modules/**" ], - "type": "node" }, { - "name": "debug-current", - "type": "node", - "runtimeArgs": [], - "request": "launch", - "program": "${file}", - "skipFiles": [ - "/**" - ] - }, - { - "name": "Debug Jest Tests", + "name": "test-node", "type": "node", "request": "launch", "runtimeArgs": [ - "--inspect-brk", - "${workspaceRoot}/../../node_modules/jest/bin/jest.js", - "./lib-umd", - "--runInBand" + "run-script", + "test-node" ], - "console": "integratedTerminal", + "runtimeExecutable": "npm", "skipFiles": [ "/**" ], "outFiles": [ - "${workspaceRoot}/lib-umd/**/*.js" - ], - "port": 9229 - }, - { - "name": "Dev", - "type": "chrome", - "request": "launch", - "url": "file:///${workspaceRoot}/index.html", - "runtimeArgs": [ - "--allow-file-access-from-files", - "--disable-web-security" - ], - "webRoot": "${workspaceRoot}" - }, - { - "type": "chrome", - "request": "launch", - "name": "index.md", - "url": "${workspaceFolder}/../../website/index.html?debug=1#packages/graph/docs/index.md", - "runtimeArgs": [ - "--allow-file-access-from-files", - "--disable-web-security" - ], - "webRoot": "${workspaceFolder}/../../website" - }, - { - "type": "chrome", - "request": "launch", - "name": "http index.md", - "url": "http://localhost:8080/${workspaceFolder}/../../website/index.html?debug=1#packages/graph/docs/index.md", - "runtimeArgs": [ - "--allow-file-access-from-files", - "--disable-web-security" + "${workspaceFolder}/**/*.js", + "!**/node_modules/**" ], - "webRoot": "${workspaceFolder}/../../website" } ] } \ No newline at end of file diff --git a/packages/dataflow/.vscode/tasks.json b/packages/dataflow/.vscode/tasks.json index be3ce235d9..a046004a24 100644 --- a/packages/dataflow/.vscode/tasks.json +++ b/packages/dataflow/.vscode/tasks.json @@ -2,9 +2,9 @@ "version": "2.0.0", "tasks": [ { - "label": "es6 watch", + "label": "check-watch", "type": "npm", - "script": "compile-es6-watch", + "script": "check-watch", "problemMatcher": [ "$tsc-watch" ], @@ -13,7 +13,18 @@ } }, { - "label": "bundle watch", + "label": "gen-types-watch", + "type": "npm", + "script": "gen-types-watch", + "problemMatcher": [ + "$tsc-watch" + ], + "presentation": { + "group": "group-build" + } + }, + { + "label": "bundle-watch", "type": "npm", "script": "bundle-watch", "problemMatcher": [], @@ -21,17 +32,26 @@ "group": "group-build" } }, + { + "type": "npm", + "label": "test-serve", + "script": "test-serve", + "presentation": { + "group": "group-build" + } + }, { "label": "build", "dependsOn": [ - "es6 watch", - "bundle watch" + "check-watch", + "gen-types-watch", + "bundle-watch", + "test-serve" ], "group": { "kind": "build", "isDefault": true - }, - "problemMatcher": [] + } } ] } \ No newline at end of file diff --git a/packages/dataflow/esbuild.js b/packages/dataflow/esbuild.js new file mode 100644 index 0000000000..ed3741d615 --- /dev/null +++ b/packages/dataflow/esbuild.js @@ -0,0 +1,9 @@ +import { browserTpl, neutralTpl, nodeTpl } from "@hpcc-js/esbuild-plugins"; + +// config --- +await neutralTpl("src/index.ts", "dist/index"); +await Promise.all([ + browserTpl("spec/index.browser.ts", "dist-test/index.browser", undefined, undefined, undefined, ["@hpcc-js/*"]), + nodeTpl("spec/index.node.ts", "dist-test/index.node", undefined, undefined, undefined, ["@hpcc-js/*"]), +]); + diff --git a/packages/dataflow/package.json b/packages/dataflow/package.json index 3f8f50eacc..01eefc5ed5 100644 --- a/packages/dataflow/package.json +++ b/packages/dataflow/package.json @@ -2,50 +2,44 @@ "name": "@hpcc-js/dataflow", "version": "9.0.0", "description": "hpcc-js - Data Flow", - "main": "dist/index.js", - "module": "lib-es6/index", - "unpkg": "dist/index.min.js", - "jsdelivr": "dist/index.min.js", - "types": "types/index.d.ts", - "typesVersions": { - "<3.8": { - "*": [ - "types-3.4/index.d.ts" - ] + "type": "module", + "exports": { + ".": { + "types": "./types/index.d.ts", + "default": "./dist/index.js" } }, + "main": "./dist/index.js", + "types": "./types/index.d.ts", "files": [ "dist/*", - "types/*", - "types-3.4/*", - "lib-es6/*", - "src/*" + "src/*", + "types/*" ], "scripts": { - "clean": "rimraf --glob lib* types dist* *.tsbuildinfo", - "compile-es6": "tsc --module es6 --outDir ./lib-es6", - "compile-es6-watch": "npm run compile-es6 -- -w", - "compile-umd": "tsc --module umd --outDir ./lib-umd", - "compile-umd-watch": "npm run compile-umd -- -w", - "bundle": "rollup -c", - "bundle-watch": "npm run bundle -- -w", - "bundle-test": "rollup -c ./rollup-test.config.mjs", - "bundle-test-watch": "npm run bundle-test -- -w", - "minimize": "terser dist/index.js -c -m --source-map \"content='dist/index.js.map',url='index.min.js.map'\" -o dist/index.min.js", - "gen-legacy-types": "downlevel-dts ./types ./types-3.4", - "build": "npm-run-all -p compile-es6 compile-umd -s bundle", - "watch": "npm-run-all compile-es6 -p compile-es6-watch bundle-watch", + "clean": "rimraf --glob lib* types dist dist-test *.tsbuildinfo .turbo", + "check": "tsc --project tsconfig.spec.json", + "check-watch": "npm run check -- --watch", + "bundle": "node esbuild.js", + "bundle-watch": "npm run bundle -- --development --watch", + "gen-types": "tsc --project tsconfig.json", + "gen-types-watch": "npm run gen-types -- --watch", + "build": "run-p gen-types bundle", "stamp": "node ../../node_modules/@hpcc-js/bundle/src/stamp.js", "lint": "eslint ./src", - "lint-fix": "eslint --fix src/**/*.ts", - "test": "mocha dist-test/index.js --reporter spec", "docs": "typedoc --options tdoptions.json .", - "update": "npx --yes npm-check-updates -u -t minor" + "test-serve": "jasmine-browser-runner serve", + "test-browser": "jasmine-browser-runner runSpecs", + "test-node": "jasmine", + "test": "run-p check test-node test-browser", + "update": "npx -y npm-check-updates -u -t minor", + "update-major": "npx -y npm-check-updates -u" }, + "dependencies": {}, "devDependencies": { - "@hpcc-js/bundle": "^2.12.0", + "@hpcc-js/esbuild-plugins": "^1.1.2", "@types/faker": "4.1.12", - "@types/mocha": "10.0.7", + "@types/jasmine": "5.1.4", "faker": "4.1.0" }, "repository": { @@ -58,5 +52,5 @@ "bugs": { "url": "https://github.com/hpcc-systems/Visualization/issues" }, - "homepage": "https://github.com/hpcc-systems/Visualization" -} + "homepage": "https://github.com/hpcc-systems/Visualization/tree/trunk/packages/dataflow" +} \ No newline at end of file diff --git a/packages/dataflow/rollup-test.config.mjs b/packages/dataflow/rollup-test.config.mjs deleted file mode 100644 index edad9fd9ae..0000000000 --- a/packages/dataflow/rollup-test.config.mjs +++ /dev/null @@ -1,32 +0,0 @@ -import { external, globals } from "@hpcc-js/bundle"; -import alias from "@rollup/plugin-alias"; -import commonjs from "@rollup/plugin-commonjs"; -import sourcemaps from "rollup-plugin-sourcemaps"; -import nodeResolve from "@rollup/plugin-node-resolve"; -import postcss from "rollup-plugin-postcss"; - -import pkg from "./package.json" with { type: "json" }; - -export default { - input: "lib-es6/__tests__/index", - external: external, - output: [{ - file: "dist-test/index.js", - format: "umd", - sourcemap: true, - globals: globals, - name: pkg.name - }], - plugins: [ - alias({}), - nodeResolve({ - preferBuiltins: true - }), - commonjs({}), - sourcemaps(), - postcss({ - extensions: [".css"], - minimize: true - }) - ] -}; \ No newline at end of file diff --git a/packages/dataflow/rollup.config.mjs b/packages/dataflow/rollup.config.mjs deleted file mode 100644 index 7a67cbb119..0000000000 --- a/packages/dataflow/rollup.config.mjs +++ /dev/null @@ -1,32 +0,0 @@ -import { external, globals } from "@hpcc-js/bundle"; -import alias from "@rollup/plugin-alias"; -import commonjs from "@rollup/plugin-commonjs"; -import sourcemaps from "rollup-plugin-sourcemaps"; -import nodeResolve from "@rollup/plugin-node-resolve"; -import postcss from "rollup-plugin-postcss"; - -import pkg from "./package.json" with { type: "json" }; - -export default { - input: "lib-es6/index", - external: external, - output: [{ - file: pkg.main, - format: "umd", - sourcemap: true, - globals: globals, - name: pkg.name - }], - plugins: [ - alias({}), - nodeResolve({ - preferBuiltins: true - }), - commonjs({}), - sourcemaps(), - postcss({ - extensions: [".css"], - minimize: true - }) - ] -}; \ No newline at end of file diff --git a/packages/dataflow/src/__tests__/chain.ts b/packages/dataflow/spec/chain.ts similarity index 93% rename from packages/dataflow/src/__tests__/chain.ts rename to packages/dataflow/spec/chain.ts index 9166d2cd8c..b87e61aee5 100644 --- a/packages/dataflow/src/__tests__/chain.ts +++ b/packages/dataflow/spec/chain.ts @@ -1,7 +1,6 @@ import { expect } from "chai"; -import { count } from "../observers/count"; -import { concat, pipe, filter, min, max, map, each, generate, sensor, scalar, activity } from "../index"; -import { person, Person, population } from "./data"; +import { count, concat, pipe, filter, min, max, map, each, generate, sensor, scalar, activity } from "@hpcc-js/dataflow"; +import { person, Person, population } from "./data.ts"; describe("chain", () => { it("generator", () => { diff --git a/packages/dataflow/src/__tests__/concat.ts b/packages/dataflow/spec/concat.ts similarity index 94% rename from packages/dataflow/src/__tests__/concat.ts rename to packages/dataflow/spec/concat.ts index 2f696dbb66..5066f5e242 100644 --- a/packages/dataflow/src/__tests__/concat.ts +++ b/packages/dataflow/spec/concat.ts @@ -1,5 +1,5 @@ import { expect } from "chai"; -import { concat } from "../index"; +import { concat } from "@hpcc-js/dataflow"; describe("concat", () => { it("generator", () => { diff --git a/packages/dataflow/src/__tests__/count.ts b/packages/dataflow/spec/count.ts similarity index 84% rename from packages/dataflow/src/__tests__/count.ts rename to packages/dataflow/spec/count.ts index f0996c4f00..a4378982db 100644 --- a/packages/dataflow/src/__tests__/count.ts +++ b/packages/dataflow/spec/count.ts @@ -1,6 +1,6 @@ import { expect } from "chai"; -import { pipe, filter, count, scalar, sensor } from "../index"; -import { population } from "./data"; +import { pipe, filter, count, scalar, sensor } from "@hpcc-js/dataflow"; +import { population } from "./data.ts"; describe("count", () => { diff --git a/packages/dataflow/src/__tests__/data.ts b/packages/dataflow/spec/data.ts similarity index 98% rename from packages/dataflow/src/__tests__/data.ts rename to packages/dataflow/spec/data.ts index 3732ad1286..24365ca21d 100644 --- a/packages/dataflow/src/__tests__/data.ts +++ b/packages/dataflow/spec/data.ts @@ -1,4 +1,4 @@ -import * as faker from "faker"; +import faker from "faker"; import { expect } from "chai"; faker.seed(123); diff --git a/packages/dataflow/src/__tests__/deviation.ts b/packages/dataflow/spec/deviation.ts similarity index 87% rename from packages/dataflow/src/__tests__/deviation.ts rename to packages/dataflow/spec/deviation.ts index a89878247f..e0ef5df42e 100644 --- a/packages/dataflow/src/__tests__/deviation.ts +++ b/packages/dataflow/spec/deviation.ts @@ -1,5 +1,5 @@ import { expect } from "chai"; -import { deviation, scalar } from "../index"; +import { deviation, scalar } from "@hpcc-js/dataflow"; describe("deviation", () => { it("scalarActivity", () => { diff --git a/packages/dataflow/src/__tests__/distribution.ts b/packages/dataflow/spec/distribution.ts similarity index 89% rename from packages/dataflow/src/__tests__/distribution.ts rename to packages/dataflow/spec/distribution.ts index ec2d825664..c45e6bf1be 100644 --- a/packages/dataflow/src/__tests__/distribution.ts +++ b/packages/dataflow/spec/distribution.ts @@ -1,5 +1,5 @@ import { expect } from "chai"; -import { distribution, scalar } from "../index"; +import { distribution, scalar } from "@hpcc-js/dataflow"; describe("distribution", () => { diff --git a/packages/dataflow/src/__tests__/each.ts b/packages/dataflow/spec/each.ts similarity index 78% rename from packages/dataflow/src/__tests__/each.ts rename to packages/dataflow/spec/each.ts index 554c29bcb4..d1e1908725 100644 --- a/packages/dataflow/src/__tests__/each.ts +++ b/packages/dataflow/spec/each.ts @@ -1,6 +1,6 @@ import { expect } from "chai"; -import { each } from "../index"; -import { population } from "./data"; +import { each } from "@hpcc-js/dataflow"; +import { population } from "./data.ts"; describe("each", () => { it("generator", () => { diff --git a/packages/dataflow/src/__tests__/entries.ts b/packages/dataflow/spec/entries.ts similarity index 90% rename from packages/dataflow/src/__tests__/entries.ts rename to packages/dataflow/spec/entries.ts index 62b142d857..a87d646897 100644 --- a/packages/dataflow/src/__tests__/entries.ts +++ b/packages/dataflow/spec/entries.ts @@ -1,5 +1,5 @@ import { expect } from "chai"; -import { entries } from "../index"; +import { entries } from "@hpcc-js/dataflow"; describe("entries", () => { it("generator", () => { diff --git a/packages/dataflow/src/__tests__/extent.ts b/packages/dataflow/spec/extent.ts similarity index 85% rename from packages/dataflow/src/__tests__/extent.ts rename to packages/dataflow/spec/extent.ts index deaef60f8f..3775b4e73e 100644 --- a/packages/dataflow/src/__tests__/extent.ts +++ b/packages/dataflow/spec/extent.ts @@ -1,6 +1,6 @@ import { expect } from "chai"; -import { pipe, filter, extent, scalar, sensor } from "../index"; -import { population } from "./data"; +import { pipe, filter, extent, scalar, sensor } from "@hpcc-js/dataflow"; +import { population } from "./data.ts"; describe("max", () => { diff --git a/packages/dataflow/src/__tests__/filter.ts b/packages/dataflow/spec/filter.ts similarity index 82% rename from packages/dataflow/src/__tests__/filter.ts rename to packages/dataflow/spec/filter.ts index 5fb599872b..0b7d64a2d5 100644 --- a/packages/dataflow/src/__tests__/filter.ts +++ b/packages/dataflow/spec/filter.ts @@ -1,6 +1,6 @@ import { expect } from "chai"; -import { filter } from "../index"; -import { population } from "./data"; +import { filter } from "@hpcc-js/dataflow"; +import { population } from "./data.ts"; const testFilter = row => row.address.state === "FL"; const expected = population.filter(testFilter); diff --git a/packages/dataflow/src/__tests__/first.ts b/packages/dataflow/spec/first.ts similarity index 91% rename from packages/dataflow/src/__tests__/first.ts rename to packages/dataflow/spec/first.ts index c8ef4e2401..f65c9c39c2 100644 --- a/packages/dataflow/src/__tests__/first.ts +++ b/packages/dataflow/spec/first.ts @@ -1,5 +1,5 @@ import { expect } from "chai"; -import { first } from "../index"; +import { first } from "@hpcc-js/dataflow"; describe("first", () => { it("generator", () => { diff --git a/packages/dataflow/src/__tests__/generate.ts b/packages/dataflow/spec/generate.ts similarity index 78% rename from packages/dataflow/src/__tests__/generate.ts rename to packages/dataflow/spec/generate.ts index cad78cc912..1a32c0451f 100644 --- a/packages/dataflow/src/__tests__/generate.ts +++ b/packages/dataflow/spec/generate.ts @@ -1,5 +1,5 @@ import { expect } from "chai"; -import { generate } from "../index"; +import { generate } from "@hpcc-js/dataflow"; describe("generate", () => { it("basic", () => { diff --git a/packages/dataflow/src/__tests__/group.ts b/packages/dataflow/spec/group.ts similarity index 85% rename from packages/dataflow/src/__tests__/group.ts rename to packages/dataflow/spec/group.ts index 496f0e734d..19e0aaa9f3 100644 --- a/packages/dataflow/src/__tests__/group.ts +++ b/packages/dataflow/spec/group.ts @@ -1,6 +1,6 @@ import { expect } from "chai"; -import { group } from "../index"; -import { Person, population } from "./data"; +import { group } from "@hpcc-js/dataflow"; +import { Person, population } from "./data.ts"; describe("group", () => { it("generator", () => { diff --git a/packages/dataflow/src/__tests__/histogram.ts b/packages/dataflow/spec/histogram.ts similarity index 93% rename from packages/dataflow/src/__tests__/histogram.ts rename to packages/dataflow/spec/histogram.ts index bad6f7b61f..9787f6ec70 100644 --- a/packages/dataflow/src/__tests__/histogram.ts +++ b/packages/dataflow/spec/histogram.ts @@ -1,6 +1,6 @@ import { expect } from "chai"; -import { histogram } from "../index"; -import { people, Person, population } from "./data"; +import { histogram } from "@hpcc-js/dataflow"; +import { people, Person, population } from "./data.ts"; describe("histogram", () => { it("generator", () => { diff --git a/packages/dataflow/spec/index.browser.ts b/packages/dataflow/spec/index.browser.ts new file mode 100644 index 0000000000..97a49e9a98 --- /dev/null +++ b/packages/dataflow/spec/index.browser.ts @@ -0,0 +1,3 @@ +jasmine.DEFAULT_TIMEOUT_INTERVAL = 30000; + +import "./index.ts"; diff --git a/packages/dataflow/spec/index.node.ts b/packages/dataflow/spec/index.node.ts new file mode 100644 index 0000000000..07591ae9d8 --- /dev/null +++ b/packages/dataflow/spec/index.node.ts @@ -0,0 +1 @@ +import "./index.ts"; diff --git a/packages/dataflow/spec/index.ts b/packages/dataflow/spec/index.ts new file mode 100644 index 0000000000..b12919e6e3 --- /dev/null +++ b/packages/dataflow/spec/index.ts @@ -0,0 +1,27 @@ +export * from "./chain.ts"; +export * from "./concat.ts"; +export * from "./count.ts"; +export * from "./data.ts"; +export * from "./deviation.ts"; +export * from "./distribution.ts"; +export * from "./each.ts"; +export * from "./entries.ts"; +export * from "./extent.ts"; +export * from "./filter.ts"; +export * from "./first.ts"; +export * from "./generate.ts"; +export * from "./group.ts"; +export * from "./histogram.ts"; +export * from "./join.ts"; +export * from "./map.ts"; +export * from "./max.ts"; +export * from "./mean.ts"; +export * from "./median.ts"; +export * from "./min.ts"; +export * from "./normalize.ts"; +export * from "./quartile.ts"; +export * from "./readme.ts"; +export * from "./reduce.ts"; +export * from "./skip.ts"; +export * from "./sort.ts"; +export * from "./variance.ts"; diff --git a/packages/dataflow/src/__tests__/join.ts b/packages/dataflow/spec/join.ts similarity index 85% rename from packages/dataflow/src/__tests__/join.ts rename to packages/dataflow/spec/join.ts index 71984cbb90..8d9dc7db95 100644 --- a/packages/dataflow/src/__tests__/join.ts +++ b/packages/dataflow/spec/join.ts @@ -1,6 +1,6 @@ import { expect } from "chai"; -import { each, join, map, normalize } from "../index"; -import { Person, population } from "./data"; +import { each, join, map, normalize } from "@hpcc-js/dataflow"; +import { Person, population } from "./data.ts"; interface PersonEx extends Person { normalizedAge: number; diff --git a/packages/dataflow/src/__tests__/map.ts b/packages/dataflow/spec/map.ts similarity index 81% rename from packages/dataflow/src/__tests__/map.ts rename to packages/dataflow/spec/map.ts index 5411573e54..b848f98242 100644 --- a/packages/dataflow/src/__tests__/map.ts +++ b/packages/dataflow/spec/map.ts @@ -1,6 +1,6 @@ import { expect } from "chai"; -import { map } from "../index"; -import { population } from "./data"; +import { map } from "@hpcc-js/dataflow"; +import { population } from "./data.ts"; const testMap = row => ({ ...row.address }); const expected = population.map(testMap); diff --git a/packages/dataflow/src/__tests__/max.ts b/packages/dataflow/spec/max.ts similarity index 90% rename from packages/dataflow/src/__tests__/max.ts rename to packages/dataflow/spec/max.ts index b64aad9874..d70f027dff 100644 --- a/packages/dataflow/src/__tests__/max.ts +++ b/packages/dataflow/spec/max.ts @@ -1,6 +1,6 @@ import { expect } from "chai"; -import { pipe, filter, max, scalar, sensor } from "../index"; -import { population } from "./data"; +import { pipe, filter, max, scalar, sensor } from "@hpcc-js/dataflow"; +import { population } from "./data.ts"; describe("max", () => { it("NumberArray", () => { diff --git a/packages/dataflow/src/__tests__/mean.ts b/packages/dataflow/spec/mean.ts similarity index 82% rename from packages/dataflow/src/__tests__/mean.ts rename to packages/dataflow/spec/mean.ts index f32bc4d13e..3edc4234ee 100644 --- a/packages/dataflow/src/__tests__/mean.ts +++ b/packages/dataflow/spec/mean.ts @@ -1,5 +1,5 @@ import { expect } from "chai"; -import { mean, scalar } from "../index"; +import { mean, scalar } from "@hpcc-js/dataflow"; describe("mean", () => { it("scalarActivity", () => { diff --git a/packages/dataflow/src/__tests__/median.ts b/packages/dataflow/spec/median.ts similarity index 89% rename from packages/dataflow/src/__tests__/median.ts rename to packages/dataflow/spec/median.ts index b5061f53ea..a55230bba6 100644 --- a/packages/dataflow/src/__tests__/median.ts +++ b/packages/dataflow/spec/median.ts @@ -1,5 +1,5 @@ import { expect } from "chai"; -import { median, scalar } from "../index"; +import { median, scalar } from "@hpcc-js/dataflow"; describe("median", () => { diff --git a/packages/dataflow/src/__tests__/min.ts b/packages/dataflow/spec/min.ts similarity index 90% rename from packages/dataflow/src/__tests__/min.ts rename to packages/dataflow/spec/min.ts index c7c0de8d72..874a813009 100644 --- a/packages/dataflow/src/__tests__/min.ts +++ b/packages/dataflow/spec/min.ts @@ -1,6 +1,6 @@ import { expect } from "chai"; -import { pipe, filter, min, scalar, sensor } from "../index"; -import { population } from "./data"; +import { pipe, filter, min, scalar, sensor } from "@hpcc-js/dataflow"; +import { population } from "./data.ts"; describe("min", () => { it("NumberArray", () => { diff --git a/packages/dataflow/src/__tests__/normalize.ts b/packages/dataflow/spec/normalize.ts similarity index 90% rename from packages/dataflow/src/__tests__/normalize.ts rename to packages/dataflow/spec/normalize.ts index c8cea9bf2e..2598ff79d2 100644 --- a/packages/dataflow/src/__tests__/normalize.ts +++ b/packages/dataflow/spec/normalize.ts @@ -1,5 +1,5 @@ import { expect } from "chai"; -import { normalize } from "../index"; +import { normalize } from "@hpcc-js/dataflow"; describe("normalize", () => { diff --git a/packages/dataflow/src/__tests__/quartile.ts b/packages/dataflow/spec/quartile.ts similarity index 90% rename from packages/dataflow/src/__tests__/quartile.ts rename to packages/dataflow/spec/quartile.ts index 44255b474d..ed21d10317 100644 --- a/packages/dataflow/src/__tests__/quartile.ts +++ b/packages/dataflow/spec/quartile.ts @@ -1,5 +1,5 @@ import { expect } from "chai"; -import { quartile, scalar } from "../index"; +import { quartile, scalar } from "@hpcc-js/dataflow"; describe("quartile", () => { diff --git a/packages/dataflow/src/__tests__/readme.ts b/packages/dataflow/spec/readme.ts similarity index 99% rename from packages/dataflow/src/__tests__/readme.ts rename to packages/dataflow/spec/readme.ts index 530192b859..37b6800c5c 100644 --- a/packages/dataflow/src/__tests__/readme.ts +++ b/packages/dataflow/spec/readme.ts @@ -1,6 +1,6 @@ import { expect } from "chai"; -import { count, filter, first, generate, map, max, pipe, sensor } from "../index"; +import { count, filter, first, generate, map, max, pipe, sensor } from "@hpcc-js/dataflow"; describe("readme", () => { diff --git a/packages/dataflow/src/__tests__/reduce.ts b/packages/dataflow/spec/reduce.ts similarity index 90% rename from packages/dataflow/src/__tests__/reduce.ts rename to packages/dataflow/spec/reduce.ts index d97a8c26b0..99aa5e6e1a 100644 --- a/packages/dataflow/src/__tests__/reduce.ts +++ b/packages/dataflow/spec/reduce.ts @@ -1,5 +1,5 @@ import { expect } from "chai"; -import { reduce, scalar } from "../index"; +import { reduce, scalar } from "@hpcc-js/dataflow"; const data = [1, 2, 3, 4, 5]; const reduceFunc = (prev, row) => prev + row; diff --git a/packages/dataflow/src/__tests__/skip.ts b/packages/dataflow/spec/skip.ts similarity index 91% rename from packages/dataflow/src/__tests__/skip.ts rename to packages/dataflow/spec/skip.ts index 4e28d119e7..45aee52fad 100644 --- a/packages/dataflow/src/__tests__/skip.ts +++ b/packages/dataflow/spec/skip.ts @@ -1,5 +1,5 @@ import { expect } from "chai"; -import { skip } from "../index"; +import { skip } from "@hpcc-js/dataflow"; describe("skip", () => { it("generator", () => { diff --git a/packages/dataflow/src/__tests__/sort.ts b/packages/dataflow/spec/sort.ts similarity index 85% rename from packages/dataflow/src/__tests__/sort.ts rename to packages/dataflow/spec/sort.ts index 0a56650460..23a97b098a 100644 --- a/packages/dataflow/src/__tests__/sort.ts +++ b/packages/dataflow/spec/sort.ts @@ -1,6 +1,6 @@ import { expect } from "chai"; -import { sort } from "../index"; -import { Person, population } from "./data"; +import { sort } from "@hpcc-js/dataflow"; +import { Person, population } from "./data.ts"; function sortFunc(l: Person, r: Person): number { const retVal = l.lname.localeCompare(r.lname); diff --git a/packages/dataflow/spec/support/jasmine-browser.mjs b/packages/dataflow/spec/support/jasmine-browser.mjs new file mode 100644 index 0000000000..37205c1a08 --- /dev/null +++ b/packages/dataflow/spec/support/jasmine-browser.mjs @@ -0,0 +1,28 @@ +import pkg from "../../package.json" with {type: "json"}; + +export default { + srcDir: "src", + srcFiles: [ + "**/*.ts" + ], + specDir: "dist-test", + specFiles: [ + "*.browser.js" + ], + esmFilenameExtension: ".js", + importMap: { + imports: { + [pkg.name]: "dist/index.js" + } + }, + env: { + stopSpecOnExpectationFailure: false, + stopOnSpecFailure: false, + random: false + }, + listenAddress: "localhost", + hostname: "localhost", + browser: { + name: "headlessFirefox" + } +}; diff --git a/packages/dataflow/spec/support/jasmine.json b/packages/dataflow/spec/support/jasmine.json new file mode 100644 index 0000000000..2ac6faaf94 --- /dev/null +++ b/packages/dataflow/spec/support/jasmine.json @@ -0,0 +1,10 @@ +{ + "spec_dir": "dist-test", + "spec_files": [ + "index.node.js" + ], + "env": { + "stopSpecOnExpectationFailure": false, + "random": false + } +} \ No newline at end of file diff --git a/packages/dataflow/src/__tests__/variance.ts b/packages/dataflow/spec/variance.ts similarity index 87% rename from packages/dataflow/src/__tests__/variance.ts rename to packages/dataflow/spec/variance.ts index 61ce1f48f5..cbfbcc2e64 100644 --- a/packages/dataflow/src/__tests__/variance.ts +++ b/packages/dataflow/spec/variance.ts @@ -1,5 +1,5 @@ import { expect } from "chai"; -import { variance, scalar } from "../index"; +import { variance, scalar } from "@hpcc-js/dataflow"; describe("variance", () => { it("scalarActivity", () => { diff --git a/packages/dataflow/src/__tests__/index.ts b/packages/dataflow/src/__tests__/index.ts deleted file mode 100644 index 9405f18a8d..0000000000 --- a/packages/dataflow/src/__tests__/index.ts +++ /dev/null @@ -1,27 +0,0 @@ -export * from "./chain"; -export * from "./concat"; -export * from "./count"; -export * from "./data"; -export * from "./deviation"; -export * from "./distribution"; -export * from "./each"; -export * from "./entries"; -export * from "./extent"; -export * from "./filter"; -export * from "./first"; -export * from "./generate"; -export * from "./group"; -export * from "./histogram"; -export * from "./join"; -export * from "./map"; -export * from "./max"; -export * from "./mean"; -export * from "./median"; -export * from "./min"; -export * from "./normalize"; -export * from "./quartile"; -export * from "./readme"; -export * from "./reduce"; -export * from "./skip"; -export * from "./sort"; -export * from "./variance"; diff --git a/packages/dataflow/src/activities/concat.ts b/packages/dataflow/src/activities/concat.ts index 7fa1b30694..73f0de179c 100644 --- a/packages/dataflow/src/activities/concat.ts +++ b/packages/dataflow/src/activities/concat.ts @@ -1,4 +1,4 @@ -import { Source, IterableActivity } from "./activity"; +import { Source, IterableActivity } from "./activity.ts"; function concatGen(concatSource: Source): IterableActivity { return function* (source: Source) { diff --git a/packages/dataflow/src/activities/each.ts b/packages/dataflow/src/activities/each.ts index 4ffee14e9f..511e987b22 100644 --- a/packages/dataflow/src/activities/each.ts +++ b/packages/dataflow/src/activities/each.ts @@ -1,4 +1,4 @@ -import { IterableActivity, Source, isSource } from "./activity"; +import { IterableActivity, Source, isSource } from "./activity.ts"; export type EachCallback = (value: T, index: number) => void; diff --git a/packages/dataflow/src/activities/entries.ts b/packages/dataflow/src/activities/entries.ts index 8fae7fae6a..952032a9d9 100644 --- a/packages/dataflow/src/activities/entries.ts +++ b/packages/dataflow/src/activities/entries.ts @@ -1,4 +1,4 @@ -import { IterableActivity, Source } from "./activity"; +import { IterableActivity, Source } from "./activity.ts"; // Array.entries function entriesGen(): IterableActivity { diff --git a/packages/dataflow/src/activities/filter.ts b/packages/dataflow/src/activities/filter.ts index fcc5c63760..8316ef9527 100644 --- a/packages/dataflow/src/activities/filter.ts +++ b/packages/dataflow/src/activities/filter.ts @@ -1,4 +1,4 @@ -import { IterableActivity, Source, isSource } from "./activity"; +import { IterableActivity, Source, isSource } from "./activity.ts"; export type FilterCallback = (value: T, index: number) => boolean; diff --git a/packages/dataflow/src/activities/first.ts b/packages/dataflow/src/activities/first.ts index 326bdde764..1611b60aa7 100644 --- a/packages/dataflow/src/activities/first.ts +++ b/packages/dataflow/src/activities/first.ts @@ -1,4 +1,4 @@ -import { IterableActivity, isSource, Source } from "./activity"; +import { IterableActivity, isSource, Source } from "./activity.ts"; function firstGen(n: number): IterableActivity { return function* (source: Source) { diff --git a/packages/dataflow/src/activities/group.ts b/packages/dataflow/src/activities/group.ts index 80828f52d3..0c1e741e87 100644 --- a/packages/dataflow/src/activities/group.ts +++ b/packages/dataflow/src/activities/group.ts @@ -1,4 +1,4 @@ -import { IterableActivity, Source, isSource } from "./activity"; +import { IterableActivity, Source, isSource } from "./activity.ts"; export type GroupFn = (row: T, index: number) => number | string; export type GroupRow = { key: string, value: T[] }; diff --git a/packages/dataflow/src/activities/histogram.ts b/packages/dataflow/src/activities/histogram.ts index 94270ec8e3..456cc081c2 100644 --- a/packages/dataflow/src/activities/histogram.ts +++ b/packages/dataflow/src/activities/histogram.ts @@ -1,6 +1,6 @@ -import { IterableActivity, Source, isSource } from "./activity"; -import { extent } from "../observers/extent"; -import { scalar } from "../observers/observer"; +import { IterableActivity, Source, isSource } from "./activity.ts"; +import { extent } from "../observers/extent.ts"; +import { scalar } from "../observers/observer.ts"; export type HistogramFn = (row: T) => number; export type HistogramRow = { from: number, to: number, value: T[] }; diff --git a/packages/dataflow/src/activities/join.ts b/packages/dataflow/src/activities/join.ts index 920fccb11c..2969a27a00 100644 --- a/packages/dataflow/src/activities/join.ts +++ b/packages/dataflow/src/activities/join.ts @@ -1,4 +1,4 @@ -import { IterableActivity, Source, isSource } from "./activity"; +import { IterableActivity, Source, isSource } from "./activity.ts"; export type JoinCallback = (rowT: T, rowU: U, index: number) => V; diff --git a/packages/dataflow/src/activities/map.ts b/packages/dataflow/src/activities/map.ts index eb9666ed5a..8a791d681b 100644 --- a/packages/dataflow/src/activities/map.ts +++ b/packages/dataflow/src/activities/map.ts @@ -1,4 +1,4 @@ -import { IterableActivity, Source, isSource } from "./activity"; +import { IterableActivity, Source, isSource } from "./activity.ts"; export type MapCallback = (row: T, index: number) => U; diff --git a/packages/dataflow/src/activities/normalize.ts b/packages/dataflow/src/activities/normalize.ts index 825d0ccce0..d12ff2bb32 100644 --- a/packages/dataflow/src/activities/normalize.ts +++ b/packages/dataflow/src/activities/normalize.ts @@ -1,7 +1,7 @@ -import { Source, IterableActivity, isSource } from "./activity"; -import { extent } from "../observers/extent"; -import { scalar } from "../observers/observer"; -import { map } from "./map"; +import { Source, IterableActivity, isSource } from "./activity.ts"; +import { extent } from "../observers/extent.ts"; +import { scalar } from "../observers/observer.ts"; +import { map } from "./map.ts"; function normalizeGen(): IterableActivity { const calcExtent = scalar(extent()); diff --git a/packages/dataflow/src/activities/skip.ts b/packages/dataflow/src/activities/skip.ts index 1947713ad1..46d13167b7 100644 --- a/packages/dataflow/src/activities/skip.ts +++ b/packages/dataflow/src/activities/skip.ts @@ -1,4 +1,4 @@ -import { IterableActivity, Source, isSource } from "./activity"; +import { IterableActivity, Source, isSource } from "./activity.ts"; function skipGen(n: number): IterableActivity { return function* (source: Source) { diff --git a/packages/dataflow/src/activities/sort.ts b/packages/dataflow/src/activities/sort.ts index 785ca77c53..dad9d2214d 100644 --- a/packages/dataflow/src/activities/sort.ts +++ b/packages/dataflow/src/activities/sort.ts @@ -1,4 +1,4 @@ -import { IterableActivity, Source, isSource } from "./activity"; +import { IterableActivity, Source, isSource } from "./activity.ts"; export type SortCallback = (a: T, b: T) => number; diff --git a/packages/dataflow/src/index.ts b/packages/dataflow/src/index.ts index 3496a47b83..e705b2fcb2 100644 --- a/packages/dataflow/src/index.ts +++ b/packages/dataflow/src/index.ts @@ -1,27 +1,27 @@ -export * from "./activities/activity"; -export * from "./activities/concat"; -export * from "./activities/each"; -export * from "./activities/entries"; -export * from "./activities/filter"; -export * from "./activities/first"; -export * from "./activities/group"; -export * from "./activities/histogram"; -export * from "./activities/join"; -export * from "./activities/map"; -export * from "./activities/normalize"; -export * from "./activities/skip"; -export * from "./activities/sort"; -export * from "./observers/count"; -export * from "./observers/deviation"; -export * from "./observers/distribution"; -export * from "./observers/extent"; -export * from "./observers/observer"; -export * from "./observers/max"; -export * from "./observers/mean"; -export * from "./observers/median"; -export * from "./observers/min"; -export * from "./observers/quartile"; -export * from "./observers/reduce"; -export * from "./observers/variance"; -export * from "./utils/generate"; -export * from "./utils/pipe"; +export * from "./activities/activity.ts"; +export * from "./activities/concat.ts"; +export * from "./activities/each.ts"; +export * from "./activities/entries.ts"; +export * from "./activities/filter.ts"; +export * from "./activities/first.ts"; +export * from "./activities/group.ts"; +export * from "./activities/histogram.ts"; +export * from "./activities/join.ts"; +export * from "./activities/map.ts"; +export * from "./activities/normalize.ts"; +export * from "./activities/skip.ts"; +export * from "./activities/sort.ts"; +export * from "./observers/count.ts"; +export * from "./observers/deviation.ts"; +export * from "./observers/distribution.ts"; +export * from "./observers/extent.ts"; +export * from "./observers/observer.ts"; +export * from "./observers/max.ts"; +export * from "./observers/mean.ts"; +export * from "./observers/median.ts"; +export * from "./observers/min.ts"; +export * from "./observers/quartile.ts"; +export * from "./observers/reduce.ts"; +export * from "./observers/variance.ts"; +export * from "./utils/generate.ts"; +export * from "./utils/pipe.ts"; diff --git a/packages/dataflow/src/observers/count.ts b/packages/dataflow/src/observers/count.ts index 739168b775..b08ed2d871 100644 --- a/packages/dataflow/src/observers/count.ts +++ b/packages/dataflow/src/observers/count.ts @@ -1,4 +1,4 @@ -import { Observer } from "./observer"; +import { Observer } from "./observer.ts"; export function count(): Observer { let count: number; diff --git a/packages/dataflow/src/observers/deviation.ts b/packages/dataflow/src/observers/deviation.ts index cd64ddf6ad..2a848b514d 100644 --- a/packages/dataflow/src/observers/deviation.ts +++ b/packages/dataflow/src/observers/deviation.ts @@ -1,5 +1,5 @@ -import { variance } from "./variance"; -import { AccessorT, Observer, Accessor } from "./observer"; +import { variance } from "./variance.ts"; +import { AccessorT, Observer, Accessor } from "./observer.ts"; function _deviation(): Observer { const v = variance(); diff --git a/packages/dataflow/src/observers/distribution.ts b/packages/dataflow/src/observers/distribution.ts index 28d909b4e1..a6eabd2682 100644 --- a/packages/dataflow/src/observers/distribution.ts +++ b/packages/dataflow/src/observers/distribution.ts @@ -1,8 +1,8 @@ -import { max } from "./max"; -import { min } from "./min"; -import { mean } from "./mean"; -import { variance } from "./variance"; -import { Observer, Accessor } from "./observer"; +import { max } from "./max.ts"; +import { min } from "./min.ts"; +import { mean } from "./mean.ts"; +import { variance } from "./variance.ts"; +import { Observer, Accessor } from "./observer.ts"; export type DistributionCallback = (row: T, currentIndex: number) => number; diff --git a/packages/dataflow/src/observers/extent.ts b/packages/dataflow/src/observers/extent.ts index c8f3ea88ee..a71b5e54cf 100644 --- a/packages/dataflow/src/observers/extent.ts +++ b/packages/dataflow/src/observers/extent.ts @@ -1,6 +1,6 @@ -import { AccessorT, Observer, Accessor } from "./observer"; -import { max } from "./max"; -import { min } from "./min"; +import { AccessorT, Observer, Accessor } from "./observer.ts"; +import { max } from "./max.ts"; +import { min } from "./min.ts"; function _extent(): Observer { const minFO = min(); diff --git a/packages/dataflow/src/observers/max.ts b/packages/dataflow/src/observers/max.ts index 4ca2e340fa..38983ae01d 100644 --- a/packages/dataflow/src/observers/max.ts +++ b/packages/dataflow/src/observers/max.ts @@ -1,4 +1,4 @@ -import { Observer, Accessor, AccessorT } from "./observer"; +import { Observer, Accessor, AccessorT } from "./observer.ts"; function _max(): Observer { let max: number; diff --git a/packages/dataflow/src/observers/mean.ts b/packages/dataflow/src/observers/mean.ts index f8113c2faf..62bfa82dcf 100644 --- a/packages/dataflow/src/observers/mean.ts +++ b/packages/dataflow/src/observers/mean.ts @@ -1,4 +1,4 @@ -import { Observer, Accessor } from "./observer"; +import { Observer, Accessor } from "./observer.ts"; function _mean(): Observer { let total: number; diff --git a/packages/dataflow/src/observers/median.ts b/packages/dataflow/src/observers/median.ts index b3a3d07dae..90fd8b3c23 100644 --- a/packages/dataflow/src/observers/median.ts +++ b/packages/dataflow/src/observers/median.ts @@ -1,4 +1,4 @@ -import { AccessorT, Observer, Accessor } from "./observer"; +import { AccessorT, Observer, Accessor } from "./observer.ts"; function _median(): Observer { let values: number[]; diff --git a/packages/dataflow/src/observers/min.ts b/packages/dataflow/src/observers/min.ts index cb0a225535..b5948f889b 100644 --- a/packages/dataflow/src/observers/min.ts +++ b/packages/dataflow/src/observers/min.ts @@ -1,4 +1,4 @@ -import { Observer, Accessor, AccessorT } from "./observer"; +import { Observer, Accessor, AccessorT } from "./observer.ts"; function _min(): Observer { let min: number; diff --git a/packages/dataflow/src/observers/observer.ts b/packages/dataflow/src/observers/observer.ts index 969b4786e9..12a884266d 100644 --- a/packages/dataflow/src/observers/observer.ts +++ b/packages/dataflow/src/observers/observer.ts @@ -1,5 +1,5 @@ -import { Source } from "../activities/activity"; -import { each } from "../activities/each"; +import { Source } from "../activities/activity.ts"; +import { each } from "../activities/each.ts"; export type AccessorT = (row: T, currentIndex: number) => U; diff --git a/packages/dataflow/src/observers/quartile.ts b/packages/dataflow/src/observers/quartile.ts index 9f0c0b2b0f..6d9f471bbb 100644 --- a/packages/dataflow/src/observers/quartile.ts +++ b/packages/dataflow/src/observers/quartile.ts @@ -1,5 +1,5 @@ -import { median } from "./median"; -import { AccessorT, Observer, Accessor, scalar } from "./observer"; +import { median } from "./median.ts"; +import { AccessorT, Observer, Accessor, scalar } from "./observer.ts"; export type QuartileAccessor = AccessorT; diff --git a/packages/dataflow/src/observers/reduce.ts b/packages/dataflow/src/observers/reduce.ts index 842468cb3e..3951d69216 100644 --- a/packages/dataflow/src/observers/reduce.ts +++ b/packages/dataflow/src/observers/reduce.ts @@ -1,4 +1,4 @@ -import { Observer } from "./observer"; +import { Observer } from "./observer.ts"; export type ReduceCallback = (previousValue: U, currentValue: T, currentIndex: number) => U; diff --git a/packages/dataflow/src/observers/variance.ts b/packages/dataflow/src/observers/variance.ts index 6bf989b6e0..a2786cf4ed 100644 --- a/packages/dataflow/src/observers/variance.ts +++ b/packages/dataflow/src/observers/variance.ts @@ -1,4 +1,4 @@ -import { AccessorT, Observer, Accessor } from "./observer"; +import { AccessorT, Observer, Accessor } from "./observer.ts"; function _variance(): Observer { let count: number; diff --git a/packages/dataflow/src/utils/pipe.ts b/packages/dataflow/src/utils/pipe.ts index 6ce54e8ebd..8d4160c66b 100644 --- a/packages/dataflow/src/utils/pipe.ts +++ b/packages/dataflow/src/utils/pipe.ts @@ -1,8 +1,8 @@ -import { IterableActivity, Source, isSource, ScalarActivity } from "../activities/activity"; +import { IterableActivity, Source, isSource, ScalarActivity } from "../activities/activity.ts"; const GeneratorFunction = (function* () { }).constructor; -function chainGen(...items: (IterableActivity | ScalarActivity)[]): IterableActivity { +function chainGen(...items: (IterableActivity | ScalarActivity)[]): IterableActivity { if (items[items.length - 1] instanceof GeneratorFunction) { return function* (source) { // @ts-ignore @@ -67,7 +67,7 @@ export function pipe(head: IterableAct export function pipe(source: Source, head: IterableActivity, i1: IterableActivity, i2: IterableActivity, i3: IterableActivity, i4: IterableActivity, i5: IterableActivity, i6: IterableActivity, i7: IterableActivity, tail: IterableActivity): IterableIterator; export function pipe(source: Source, head: IterableActivity, i1: IterableActivity, i2: IterableActivity, i3: IterableActivity, i4: IterableActivity, i5: IterableActivity, i6: IterableActivity, i7: IterableActivity, tail: ScalarActivity): U; export function pipe(s_or_ia: Source | IterableActivity, ...items: (IterableActivity | ScalarActivity)[]): IterableActivity | ScalarActivity | IterableIterator { - return isSource(s_or_ia) ? chainGen(...items)(s_or_ia) : chainGen(s_or_ia, ...items); + return isSource(s_or_ia) ? chainGen(...items)(s_or_ia) : chainGen(s_or_ia as IterableActivity, ...items); } // Maintain backward compatibility diff --git a/packages/dataflow/tsconfig.json b/packages/dataflow/tsconfig.json index a2a04c6617..01dec5ab90 100644 --- a/packages/dataflow/tsconfig.json +++ b/packages/dataflow/tsconfig.json @@ -1,19 +1,22 @@ { - "extends": "../tsconfig.settings.json", "compilerOptions": { - "target": "ES2015", - "rootDir": "./src", - "outDir": "./lib-umd", - "declarationDir": "./types", - "downlevelIteration": true, - "strictNullChecks": true, - "noImplicitThis": true, - "types": [ - "mocha", - "chai" + "rootDir": "src", + "module": "NodeNext", + "target": "ESNext", + "resolveJsonModule": true, + "emitDeclarationOnly": true, + "declaration": true, + "declarationDir": "types", + "strict": true, + "skipLibCheck": true, + "allowImportingTsExtensions": true, + "lib": [ + "DOM", + "ESNext", + "ES2020" ] }, "include": [ - "./src/**/*" + "./src/index.ts" ] } \ No newline at end of file diff --git a/packages/dataflow/tsconfig.spec.json b/packages/dataflow/tsconfig.spec.json new file mode 100644 index 0000000000..cfd3249890 --- /dev/null +++ b/packages/dataflow/tsconfig.spec.json @@ -0,0 +1,16 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "rootDir": ".", + "noEmit": true, + "emitDeclarationOnly": false, + "noImplicitAny": false, + "types": [ + "jasmine" + ] + }, + "include": [ + "./spec/index.browser.ts", + "./spec/index.node.ts" + ] +} \ No newline at end of file diff --git a/packages/dgrid/tsconfig.json b/packages/dgrid/tsconfig.json index 19555735db..74e240a333 100644 --- a/packages/dgrid/tsconfig.json +++ b/packages/dgrid/tsconfig.json @@ -18,8 +18,5 @@ { "path": "../dgrid-shim" }, - { - "path": "../util" - } ] } \ No newline at end of file diff --git a/packages/dgrid2/tsconfig.json b/packages/dgrid2/tsconfig.json index 9d640fe38f..5e7941733d 100644 --- a/packages/dgrid2/tsconfig.json +++ b/packages/dgrid2/tsconfig.json @@ -14,8 +14,5 @@ { "path": "../common" }, - { - "path": "../util" - } ] } \ No newline at end of file diff --git a/packages/eclwatch/tsconfig.json b/packages/eclwatch/tsconfig.json index dd73ab7cc3..fcf6bea2e7 100644 --- a/packages/eclwatch/tsconfig.json +++ b/packages/eclwatch/tsconfig.json @@ -27,8 +27,5 @@ { "path": "../timeline" }, - { - "path": "../util" - } ] } \ No newline at end of file diff --git a/packages/esbuild-plugins/package.json b/packages/esbuild-plugins/package.json index 58cd4fa2d9..386190f2d1 100644 --- a/packages/esbuild-plugins/package.json +++ b/packages/esbuild-plugins/package.json @@ -34,9 +34,6 @@ "lint-skypack": "npx -y @skypack/package-check", "lint-eslint": "eslint src/**/*.ts", "lint": "run-p lint-eslint lint-skypack", - "test-cli": "npx . -v", - "test-cli-help": "npx .", - "test-node": "npx . -v", "update": "npx --yes npm-check-updates -u -t minor" }, "dependencies": { @@ -58,4 +55,4 @@ }, "homepage": "https://hpcc-systems.github.io/hpcc-js-wasm/", "license": "Apache-2.0" -} +} \ No newline at end of file diff --git a/packages/esbuild-plugins/src/build.ts b/packages/esbuild-plugins/src/build.ts index bafa138d9b..488c5956c3 100644 --- a/packages/esbuild-plugins/src/build.ts +++ b/packages/esbuild-plugins/src/build.ts @@ -19,7 +19,7 @@ export async function buildWatch(input: string, format: Format | "umd" = "esm", format: format as Format, bundle: true, minify: isProduction, - sourcemap: isDevelopment, + sourcemap: true, external, ...config, plugins: [ @@ -65,8 +65,25 @@ export function nodeTpl(input: string, output: string, format: Format | "umd" = } export function neutralTpl(input: string, output: string, format: Format | "umd" = "esm", globalName?: string, libraryName?: string, external: string[] = []) { + let postfix = ""; + switch (format) { + case "iife": + postfix = "iife.js"; + break; + case "esm": + postfix = NODE_MJS; + break; + case "cjs": + postfix = NODE_CJS; + break; + case "umd": + postfix = "umd.js"; + break; + default: + throw new Error(`Unknown format: ${format}`); + } return buildWatch(input, format, external, { - outfile: `${output}.${format === "esm" ? "js" : "umd.js"}`, + outfile: `${output}.${format === "esm" ? "js" : `${format}.js`}`, platform: "neutral", target: "es2022", globalName, diff --git a/packages/graph/tsconfig.json b/packages/graph/tsconfig.json index fff8afa351..a2d5e4b44b 100644 --- a/packages/graph/tsconfig.json +++ b/packages/graph/tsconfig.json @@ -10,9 +10,6 @@ "./src/**/*" ], "references": [ - { - "path": "../util" - }, { "path": "../api" }, diff --git a/packages/html/tsconfig.json b/packages/html/tsconfig.json index 6151a5784e..a2506a626f 100644 --- a/packages/html/tsconfig.json +++ b/packages/html/tsconfig.json @@ -16,8 +16,5 @@ { "path": "../common" }, - { - "path": "../util" - } ] } \ No newline at end of file diff --git a/packages/loader/tsconfig.json b/packages/loader/tsconfig.json index 7e2aa0d201..85d086b5c5 100644 --- a/packages/loader/tsconfig.json +++ b/packages/loader/tsconfig.json @@ -69,8 +69,5 @@ { "path": "../tree" }, - { - "path": "../util" - } ] } \ No newline at end of file diff --git a/packages/map/util/package.json b/packages/map/util/package.json index b88d83f0c9..7f02279013 100644 --- a/packages/map/util/package.json +++ b/packages/map/util/package.json @@ -4,7 +4,7 @@ "description": "", "main": "calcIDs.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "test-old": "echo \"Error: no test specified\" && exit 1" }, "author": "", "license": "BSD-2-Clause", diff --git a/packages/marshaller/tsconfig.json b/packages/marshaller/tsconfig.json index 7a26b11fed..18d69bbeb9 100644 --- a/packages/marshaller/tsconfig.json +++ b/packages/marshaller/tsconfig.json @@ -48,8 +48,5 @@ { "path": "../phosphor" }, - { - "path": "../util" - } ] -} +} \ No newline at end of file diff --git a/packages/observable-shim/.vscode/launch.json b/packages/observable-shim/.vscode/launch.json index e603499af0..3ee32e4122 100644 --- a/packages/observable-shim/.vscode/launch.json +++ b/packages/observable-shim/.vscode/launch.json @@ -1,33 +1,33 @@ { - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { - "name": "index.html (file)", - "type": "pwa-msedge", + "name": "test-browser", + "type": "msedge", "request": "launch", - "url": "${workspaceFolder}/index.html", - "webRoot": "${workspaceFolder}" - }, - { - "name": "index.html (http)", - "type": "pwa-msedge", - "request": "launch", - "url": "http://localhost:8080/index.html", - "webRoot": "${workspaceFolder}" + "url": "http://localhost:8888", + "webRoot": "${workspaceFolder}", + "outFiles": [ + "${workspaceFolder}/**/*.js", + "!**/node_modules/**" + ], }, { - "type": "pwa-msedge", + "name": "test-node", + "type": "node", "request": "launch", - "name": "Docs", - "url": "${workspaceFolder}/../../website/index.html?debug=1#packages/react/docs/index.md", "runtimeArgs": [ - "--allow-file-access-from-files", - "--disable-web-security" + "run-script", + "test-node" + ], + "runtimeExecutable": "npm", + "skipFiles": [ + "/**" + ], + "outFiles": [ + "${workspaceFolder}/**/*.js", + "!**/node_modules/**" ], - "webRoot": "${workspaceFolder}/../../website" } ] } \ No newline at end of file diff --git a/packages/observable-shim/.vscode/tasks.json b/packages/observable-shim/.vscode/tasks.json index be3ce235d9..a046004a24 100644 --- a/packages/observable-shim/.vscode/tasks.json +++ b/packages/observable-shim/.vscode/tasks.json @@ -2,9 +2,9 @@ "version": "2.0.0", "tasks": [ { - "label": "es6 watch", + "label": "check-watch", "type": "npm", - "script": "compile-es6-watch", + "script": "check-watch", "problemMatcher": [ "$tsc-watch" ], @@ -13,7 +13,18 @@ } }, { - "label": "bundle watch", + "label": "gen-types-watch", + "type": "npm", + "script": "gen-types-watch", + "problemMatcher": [ + "$tsc-watch" + ], + "presentation": { + "group": "group-build" + } + }, + { + "label": "bundle-watch", "type": "npm", "script": "bundle-watch", "problemMatcher": [], @@ -21,17 +32,26 @@ "group": "group-build" } }, + { + "type": "npm", + "label": "test-serve", + "script": "test-serve", + "presentation": { + "group": "group-build" + } + }, { "label": "build", "dependsOn": [ - "es6 watch", - "bundle watch" + "check-watch", + "gen-types-watch", + "bundle-watch", + "test-serve" ], "group": { "kind": "build", "isDefault": true - }, - "problemMatcher": [] + } } ] } \ No newline at end of file diff --git a/packages/observable-shim/esbuild.js b/packages/observable-shim/esbuild.js new file mode 100644 index 0000000000..ed3741d615 --- /dev/null +++ b/packages/observable-shim/esbuild.js @@ -0,0 +1,9 @@ +import { browserTpl, neutralTpl, nodeTpl } from "@hpcc-js/esbuild-plugins"; + +// config --- +await neutralTpl("src/index.ts", "dist/index"); +await Promise.all([ + browserTpl("spec/index.browser.ts", "dist-test/index.browser", undefined, undefined, undefined, ["@hpcc-js/*"]), + nodeTpl("spec/index.node.ts", "dist-test/index.node", undefined, undefined, undefined, ["@hpcc-js/*"]), +]); + diff --git a/packages/observable-shim/package.json b/packages/observable-shim/package.json index 3ad3bbddf6..9bd9b1ee63 100644 --- a/packages/observable-shim/package.json +++ b/packages/observable-shim/package.json @@ -2,34 +2,41 @@ "name": "@hpcc-js/observable-shim", "version": "2.6.0", "description": "hpcc-js - Observable Shim", - "main": "dist/index.cjs", - "module": "dist/index.js", - "types": "types/index.d.ts", - "typesVersions": { - "<3.8": { - "*": [ - "types-3.4/index.d.ts" - ] + "type": "module", + "exports": { + ".": { + "types": "./types/index.d.ts", + "default": "./dist/index.js" } }, + "main": "./dist/index.js", + "types": "./types/index.d.ts", "files": [ "dist/*", - "types/*", - "types-3.4/*" + "src/*", + "types/*" ], "scripts": { - "clean": "rimraf --glob lib* types dist *.tsbuildinfo", - "compile-es6": "tsc --module es2020 --outDir ./lib-es6", - "compile-es6-watch": "npm run compile-es6 -- -w", - "bundle": "rollup -c", - "bundle-watch": "npm run bundle -- -w", - "build": "npm run compile-es6 && npm run bundle", - "watch": "npm-run-all compile-es6 -p compile-es6-watch bundle-watch", + "clean": "rimraf --glob lib* types dist dist-test *.tsbuildinfo .turbo", + "check": "tsc --project tsconfig.spec.json", + "check-watch": "npm run check -- --watch", + "bundle": "node esbuild.js", + "bundle-watch": "npm run bundle -- --development --watch", + "gen-types": "tsc --project tsconfig.json", + "gen-types-watch": "npm run gen-types -- --watch", + "build": "run-p gen-types bundle", + "stamp": "node ../../node_modules/@hpcc-js/bundle/src/stamp.js", "lint": "eslint ./src", - "update": "npx --yes npm-check-updates -u -t minor" + "docs": "typedoc --options tdoptions.json .", + "test-serve": "jasmine-browser-runner serve", + "test-browser": "jasmine-browser-runner runSpecs", + "test-node": "jasmine", + "test": "run-p check test-node test-browser", + "update": "npx -y npm-check-updates -u -t minor", + "update-major": "npx -y npm-check-updates -u" }, "devDependencies": { - "@hpcc-js/bundle": "^2.12.0", + "@hpcc-js/esbuild-plugins": "^1.1.2", "@observablehq/parser": "6.1.0" }, "repository": { @@ -42,5 +49,5 @@ "bugs": { "url": "https://github.com/hpcc-systems/Visualization/issues" }, - "homepage": "https://github.com/hpcc-systems/Visualization" -} + "homepage": "https://github.com/hpcc-systems/Visualization/tree/trunk/packages/observable-shim" +} \ No newline at end of file diff --git a/packages/observable-shim/rollup.config.mjs b/packages/observable-shim/rollup.config.mjs deleted file mode 100644 index 5bcf0ca786..0000000000 --- a/packages/observable-shim/rollup.config.mjs +++ /dev/null @@ -1,46 +0,0 @@ -import alias from "@rollup/plugin-alias"; -import sourcemaps from "rollup-plugin-sourcemaps"; -import nodeResolve from "@rollup/plugin-node-resolve"; -import postcss from "rollup-plugin-postcss"; -import { globals } from "@hpcc-js/bundle"; - -import pkg from "./package.json" with { type: "json" }; - -const plugins = [ - alias({ - entries: [ - ] - }), - nodeResolve({ - preferBuiltins: true, - }), - sourcemaps(), - postcss({ - extensions: [".css"], - extract: true, - minimize: true - }) -]; - -export default [{ - input: "lib-es6/index", - output: [{ - file: pkg.main, - format: "umd", - sourcemap: true, - name: pkg.name, - globals - }, { - file: pkg.module, - format: "es", - sourcemap: true, - globals - }], - treeshake: { - moduleSideEffects: (id, external) => { - if (id.indexOf(".css") >= 0) return true; - return false; - } - }, - plugins: plugins -}]; diff --git a/packages/observable-shim/spec/index.browser.ts b/packages/observable-shim/spec/index.browser.ts new file mode 100644 index 0000000000..97a49e9a98 --- /dev/null +++ b/packages/observable-shim/spec/index.browser.ts @@ -0,0 +1,3 @@ +jasmine.DEFAULT_TIMEOUT_INTERVAL = 30000; + +import "./index.ts"; diff --git a/packages/observable-shim/spec/index.node.ts b/packages/observable-shim/spec/index.node.ts new file mode 100644 index 0000000000..07591ae9d8 --- /dev/null +++ b/packages/observable-shim/spec/index.node.ts @@ -0,0 +1 @@ +import "./index.ts"; diff --git a/packages/observable-shim/spec/index.ts b/packages/observable-shim/spec/index.ts new file mode 100644 index 0000000000..f8b526240b --- /dev/null +++ b/packages/observable-shim/spec/index.ts @@ -0,0 +1,7 @@ +import { expect } from "chai"; + +describe("@hpcc-js/observable-shim", () => { + it("shim has no tests", () => { + expect(true).to.be.true; + }); +}); \ No newline at end of file diff --git a/packages/observable-shim/spec/support/jasmine-browser.mjs b/packages/observable-shim/spec/support/jasmine-browser.mjs new file mode 100644 index 0000000000..37205c1a08 --- /dev/null +++ b/packages/observable-shim/spec/support/jasmine-browser.mjs @@ -0,0 +1,28 @@ +import pkg from "../../package.json" with {type: "json"}; + +export default { + srcDir: "src", + srcFiles: [ + "**/*.ts" + ], + specDir: "dist-test", + specFiles: [ + "*.browser.js" + ], + esmFilenameExtension: ".js", + importMap: { + imports: { + [pkg.name]: "dist/index.js" + } + }, + env: { + stopSpecOnExpectationFailure: false, + stopOnSpecFailure: false, + random: false + }, + listenAddress: "localhost", + hostname: "localhost", + browser: { + name: "headlessFirefox" + } +}; diff --git a/packages/observable-shim/spec/support/jasmine.json b/packages/observable-shim/spec/support/jasmine.json new file mode 100644 index 0000000000..2ac6faaf94 --- /dev/null +++ b/packages/observable-shim/spec/support/jasmine.json @@ -0,0 +1,10 @@ +{ + "spec_dir": "dist-test", + "spec_files": [ + "index.node.js" + ], + "env": { + "stopSpecOnExpectationFailure": false, + "random": false + } +} \ No newline at end of file diff --git a/packages/observable-shim/src/index.ts b/packages/observable-shim/src/index.ts index 5382b00175..2abdd10daf 100644 --- a/packages/observable-shim/src/index.ts +++ b/packages/observable-shim/src/index.ts @@ -1,2 +1,2 @@ -export type { ohq } from "./types"; -export * from "./parse"; +export type { ohq } from "./types.ts"; +export * from "./parse.ts"; diff --git a/packages/observable-shim/src/parse.ts b/packages/observable-shim/src/parse.ts index 0183bd4d53..d308a40d8c 100644 --- a/packages/observable-shim/src/parse.ts +++ b/packages/observable-shim/src/parse.ts @@ -1,10 +1,21 @@ // Compare with ../../../node_modules/@observablehq/parser/src/parse.js -import { getLineInfo, tokTypes as tt } from "acorn"; -import { parseCell as ohqParseCell, CellParser } from "@observablehq/parser"; +import { getLineInfo, tokTypes, Statement, ModuleDeclaration, Expression as ExpressionBase, Node } from "acorn"; +import { ancestor, RecursiveVisitors, AncestorVisitors } from "acorn-walk"; +import { CellParser, parseCell as ohqParseCell, walk as ohqWalk } from "@observablehq/parser"; import defaultGlobals from "../../../node_modules/@observablehq/parser/src/globals.js"; import findReferences from "../../../node_modules/@observablehq/parser/src/references.js"; import findFeatures from "../../../node_modules/@observablehq/parser/src/features.js"; +export interface MutableExpression extends Node { + type: "MutableExpression" +} + +export interface ViewExpression extends Node { + type: "ViewExpression" +} + +export type Expression = ExpressionBase | MutableExpression | ViewExpression; + // Find references. // Check for illegal references to arguments. // Check for illegal assignments to global references. @@ -19,7 +30,7 @@ function parseReferences(cell, input, globals = defaultGlobals) { } else { try { cell.references = findReferences(cell, globals); - } catch (error) { + } catch (error: any) { if (error.node) { const loc = getLineInfo(input, error.node.start); error.message += ` (${loc.line}:${loc.column})`; @@ -42,7 +53,7 @@ function parseFeatures(cell, input) { cell.fileAttachments = findFeatures(cell, "FileAttachment"); cell.databaseClients = findFeatures(cell, "DatabaseClient"); cell.secrets = findFeatures(cell, "Secret"); - } catch (error) { + } catch (error: any) { if (error.node) { const loc = getLineInfo(input, error.node.start); error.message += ` (${loc.line}:${loc.column})`; @@ -62,12 +73,12 @@ function parseFeatures(cell, input) { class ModuleParser extends CellParser { - parseTopLevel(node) { + parseTopLevel(node: { cells?: Cell[] }) { if (!node.cells) node.cells = []; // @ts-ignore - while (this.type !== tt.eof) { + while (this.type !== tokTypes.eof) { // @ts-ignore - const cell = this.parseCell(this.startNode()); + const cell: Cell = this.parseCell(this.startNode()); // @ts-ignore cell.input = this.input; node.cells.push(cell); @@ -90,23 +101,36 @@ export function parseModule(input, { globals } = {}) { return program; } -export interface Cell { +export interface Cell extends Node { + type: "Cell"; + id: Expression; text: string; - start: number; - end: number; + body?: Statement | ModuleDeclaration | Expression; + references: unknown[]; + async: boolean; + generator: boolean; + strict: boolean; } export function splitModule(input: string): Cell[] { return (ModuleParser as any) .parse(input, { ecmaVersion: "latest" }) .cells.map((cell: any) => ({ + type: "Cell", text: input.substring(cell.start, cell.end), start: cell.start, end: cell.end })); } -export function parseCell(input: string) { +export { + Node, + ancestor, + AncestorVisitors +}; + +export function parseCell(input: string): Cell { return ohqParseCell(input); } +export const walk: RecursiveVisitors = ohqWalk; diff --git a/packages/observable-shim/tsconfig.json b/packages/observable-shim/tsconfig.json index 7f1ee00a1f..7d5fef25af 100644 --- a/packages/observable-shim/tsconfig.json +++ b/packages/observable-shim/tsconfig.json @@ -1,19 +1,23 @@ { - "extends": "../tsconfig.settings.json", "compilerOptions": { - "rootDir": "./src", - "outDir": "./lib-umd", - "declarationDir": "./types", - "module": "ES6", - "target": "ES2021", - "noImplicitThis": true, + "rootDir": "src", + "module": "NodeNext", + "target": "ESNext", + "resolveJsonModule": true, + "emitDeclarationOnly": true, + "declaration": true, + "declarationDir": "types", + "strict": true, + "noImplicitAny": false, + "skipLibCheck": true, + "allowImportingTsExtensions": true, "lib": [ - "ES2021", - "DOM" + "DOM", + "ESNext", + "ES2020" ] }, "include": [ - "./src/**/*" - ], - "references": [] + "./src/index.ts" + ] } \ No newline at end of file diff --git a/packages/observable-shim/tsconfig.spec.json b/packages/observable-shim/tsconfig.spec.json new file mode 100644 index 0000000000..cfd3249890 --- /dev/null +++ b/packages/observable-shim/tsconfig.spec.json @@ -0,0 +1,16 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "rootDir": ".", + "noEmit": true, + "emitDeclarationOnly": false, + "noImplicitAny": false, + "types": [ + "jasmine" + ] + }, + "include": [ + "./spec/index.browser.ts", + "./spec/index.node.ts" + ] +} \ No newline at end of file diff --git a/packages/observablehq-compiler/.vscode/launch.json b/packages/observablehq-compiler/.vscode/launch.json index 3ba13f05d5..3ee32e4122 100644 --- a/packages/observablehq-compiler/.vscode/launch.json +++ b/packages/observablehq-compiler/.vscode/launch.json @@ -1,69 +1,33 @@ { - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { - "name": "test-node", - "request": "launch", - "runtimeArgs": [ - "run-script", - "test-node" - ], - "runtimeExecutable": "npm", - "skipFiles": [ - "/**" - ], - "type": "node" - }, - { - "name": "test.html (file)", + "name": "test-browser", "type": "msedge", "request": "launch", - "url": "${workspaceFolder}/test.html", - "webRoot": "${workspaceFolder}" - }, - { - "name": "test-cli-download", - "program": "${workspaceFolder}/bin/ojscc.mjs", - "request": "launch", - "args": [ - "download", - "-o", - "tmp.ojsnb", - "https://observablehq.com/@observablehq/introduction-to-data", - ], - "skipFiles": [ - "/**" + "url": "http://localhost:8888", + "webRoot": "${workspaceFolder}", + "outFiles": [ + "${workspaceFolder}/**/*.js", + "!**/node_modules/**" ], - "type": "node" }, { - "name": "test-cli-compile", - "program": "${workspaceFolder}/bin/ojscc.mjs", + "name": "test-node", + "type": "node", "request": "launch", - "args": [ - "compile", - "-o", - "tmp.js", - "https://observablehq.com/@observablehq/introduction-to-imports", + "runtimeArgs": [ + "run-script", + "test-node" ], + "runtimeExecutable": "npm", "skipFiles": [ "/**" ], - "type": "node" - }, - { - "type": "msedge", - "request": "launch", - "name": "Docs", - "url": "${workspaceFolder}/../../website/index.html?debug=1#packages/react/docs/index.md", - "runtimeArgs": [ - "--allow-file-access-from-files", - "--disable-web-security" + "outFiles": [ + "${workspaceFolder}/**/*.js", + "!**/node_modules/**" ], - "webRoot": "${workspaceFolder}/../../website" } ] } \ No newline at end of file diff --git a/packages/observablehq-compiler/.vscode/tasks.json b/packages/observablehq-compiler/.vscode/tasks.json index 43dc26f7cd..a046004a24 100644 --- a/packages/observablehq-compiler/.vscode/tasks.json +++ b/packages/observablehq-compiler/.vscode/tasks.json @@ -2,9 +2,9 @@ "version": "2.0.0", "tasks": [ { - "label": "esm watch", + "label": "check-watch", "type": "npm", - "script": "compile-es6-watch", + "script": "check-watch", "problemMatcher": [ "$tsc-watch" ], @@ -13,9 +13,9 @@ } }, { - "label": "umd watch", + "label": "gen-types-watch", "type": "npm", - "script": "compile-umd-watch", + "script": "gen-types-watch", "problemMatcher": [ "$tsc-watch" ], @@ -24,7 +24,7 @@ } }, { - "label": "bundle watch", + "label": "bundle-watch", "type": "npm", "script": "bundle-watch", "problemMatcher": [], @@ -32,18 +32,26 @@ "group": "group-build" } }, + { + "type": "npm", + "label": "test-serve", + "script": "test-serve", + "presentation": { + "group": "group-build" + } + }, { "label": "build", "dependsOn": [ - "esm watch", - "umd watch", - "bundle watch" + "check-watch", + "gen-types-watch", + "bundle-watch", + "test-serve" ], "group": { "kind": "build", "isDefault": true - }, - "problemMatcher": [] + } } ] } \ No newline at end of file diff --git a/packages/observablehq-compiler/bin/ojscc.mjs b/packages/observablehq-compiler/bin/ojscc.mjs index 805dbea687..ad9ac8a53e 100644 --- a/packages/observablehq-compiler/bin/ojscc.mjs +++ b/packages/observablehq-compiler/bin/ojscc.mjs @@ -1,14 +1,11 @@ #!/usr/bin/env node -/* eslint-disable no-undef */ -/* eslint-disable @typescript-eslint/no-var-requires */ - -import fetch, { Blob, blobFrom, blobFromSync, File, fileFrom, fileFromSync, FormData, Headers, Request, Response } from "node-fetch"; -if (!globalThis.fetch) { - globalThis.fetch = fetch; - globalThis.Headers = Headers; - globalThis.Request = Request; - globalThis.Response = Response; -} +// import fetch, { Headers, Request, Response } from "node-fetch"; +// if (!globalThis.fetch) { +// globalThis.fetch = fetch; +// globalThis.Headers = Headers; +// globalThis.Request = Request; +// globalThis.Response = Response; +// } import { promises as fs } from "fs"; import { compile, download } from "../dist/index.js"; import yargsMode from "yargs/yargs"; @@ -16,7 +13,7 @@ import yargsMode from "yargs/yargs"; async function doDownload(url, filePath) { const nb = await download(url); if (filePath) { - fs.writeFile(filePath, JSON.stringify(nb, undefined, 4)); + await fs.writeFile(filePath, JSON.stringify(nb, undefined, 4)); } else { console.info(nb); } @@ -27,7 +24,7 @@ async function doCompile(url, filePath) { const define = await compile(nb, process.cwd()); const js = define.toString(); if (filePath) { - fs.writeFile(filePath, js); + await fs.writeFile(filePath, js); } else { console.info(js); } @@ -37,6 +34,7 @@ const yargs = yargsMode(process.argv.slice(2)); yargs .scriptName("ojscc") .wrap(Math.min(90, yargs.terminalWidth())) + .demandCommand(1, "You need to provide at least one command...") .command("download", "Download ObservableHQ Notebook", function (yargs) { return yargs @@ -45,8 +43,7 @@ yargs .option("o", { alias: "output", describe: "Optional output file path" - }) - ; + }); }, function (argv) { doDownload(argv._[1], argv.o); } @@ -59,8 +56,7 @@ yargs .option("o", { alias: "output", describe: "Optional output file path" - }) - ; + }); }, async function (argv) { doCompile(argv._[1], argv.o); @@ -69,6 +65,4 @@ yargs .help("h") .alias("h", "help") .epilog("https://github.com/hpcc-systems/Visualization/tree/trunk/packages/observablehq-compiler") - ; - -yargs.argv; + .argv; diff --git a/packages/observablehq-compiler/esbuild.js b/packages/observablehq-compiler/esbuild.js new file mode 100644 index 0000000000..ed3741d615 --- /dev/null +++ b/packages/observablehq-compiler/esbuild.js @@ -0,0 +1,9 @@ +import { browserTpl, neutralTpl, nodeTpl } from "@hpcc-js/esbuild-plugins"; + +// config --- +await neutralTpl("src/index.ts", "dist/index"); +await Promise.all([ + browserTpl("spec/index.browser.ts", "dist-test/index.browser", undefined, undefined, undefined, ["@hpcc-js/*"]), + nodeTpl("spec/index.node.ts", "dist-test/index.node", undefined, undefined, undefined, ["@hpcc-js/*"]), +]); + diff --git a/packages/observablehq-compiler/index.html b/packages/observablehq-compiler/index.html index a70520f583..573ce667ae 100644 --- a/packages/observablehq-compiler/index.html +++ b/packages/observablehq-compiler/index.html @@ -6,23 +6,16 @@ @hpcc-js/observable-md - - + +
- diff --git a/packages/observablehq-compiler/package.json b/packages/observablehq-compiler/package.json index 8915c6a31a..e243f45778 100644 --- a/packages/observablehq-compiler/package.json +++ b/packages/observablehq-compiler/package.json @@ -2,73 +2,64 @@ "name": "@hpcc-js/observablehq-compiler", "version": "1.3.0", "description": "hpcc-js - ObservableHQ Compiler (unoffical)", - "keywords": [ - "observablehq", - "markdown", - "observable", - "compiler", - "interpreter", - "renderer" - ], - "main": "dist/index.js", - "module": "dist/index.esm.js", - "browser": "dist/index.js", - "unpkg": "dist/index.min.js", - "jsdelivr": "dist/index.min.js", - "types": "types/index.d.ts", - "typesVersions": { - "<3.8": { - "*": [ - "types-3.4/index.d.ts" - ] + "type": "module", + "exports": { + ".": { + "types": "./types/index.d.ts", + "default": "./dist/index.js" } }, - "bin": { - "ojscc": "bin/ojscc.mjs" - }, + "main": "./dist/index.js", + "types": "./types/index.d.ts", "files": [ "dist/*", - "types/*", - "types-3.4/*", - "src/*" + "src/*", + "types/*" ], + "bin": { + "ojscc": "bin/ojscc.mjs" + }, "scripts": { - "clean": "rimraf --glob lib* dist* types *.tsbuildinfo", - "compile-es6": "tsc --module es2020 --outDir ./lib-es6", - "compile-es6-watch": "npm run compile-es6 -- -w", - "compile-umd": "tsc --module umd --outDir ./lib-umd", - "compile-umd-watch": "npm run compile-umd -- -w", - "bundle": "rollup -c", - "bundle-watch": "npm run bundle -- -w", - "minimize-index": "terser dist/index.js -c -m --source-map \"content='dist/index.js.map',url='index.min.js.map'\" -o dist/index.min.js", - "minimize-index-es6": "terser dist/index.esm.js -c -m --source-map \"content='dist/index.esm.js.map',url='index.esm.min.js.map'\" -o dist/index.esm.min.js", - "minimize": "run-p minimize-index minimize-index-es6", - "gen-legacy-types": "downlevel-dts ./types ./types-3.4", - "build": "npm run compile-es6 && npm run bundle", - "watch": "npm-run-all compile-es6 -p compile-es6-watch bundle-watch", + "clean": "rimraf --glob lib* types dist dist-test *.tsbuildinfo .turbo", + "check": "tsc --project tsconfig.spec.json", + "check-watch": "npm run check -- --watch", + "bundle": "node esbuild.js", + "bundle-watch": "npm run bundle -- --development --watch", + "gen-types": "tsc --project tsconfig.json", + "gen-types-watch": "npm run gen-types -- --watch", + "build": "run-p gen-types bundle", "stamp": "node ../../node_modules/@hpcc-js/bundle/src/stamp.js", "lint": "eslint ./src", "docs": "typedoc --options tdoptions.json .", - "dev-start": "ws", - "test-cli": "node ./bin/ojscc.mjs --version", - "test-node": "mocha ./dist-test/index.mjs --reporter spec", - "test": "run-s test-cli test-node", - "update": "npx --yes npm-check-updates -u -t minor" + "test-serve": "jasmine-browser-runner serve", + "test-browser": "jasmine-browser-runner runSpecs", + "test-node": "jasmine", + "test-bin": "node ./bin/ojscc.mjs --version", + "test": "run-p check test-node test-browser test-bin", + "update": "npx -y npm-check-updates -u -t minor", + "update-major": "npx -y npm-check-updates -u" }, "dependencies": { - "@hpcc-js/observable-shim": "^2.6.0", - "node-fetch": "3.3.2", "yargs": "17.7.2" }, "devDependencies": { - "@hpcc-js/bundle": "^2.12.0", + "@hpcc-js/esbuild-plugins": "^1.1.2", + "@hpcc-js/observable-shim": "^2.6.0", "@observablehq/runtime": "5.9.8", - "tslib": "2.6.3" + "@types/jasmine": "5.1.4" }, "repository": { "type": "git", "url": "git+https://github.com/hpcc-systems/Visualization.git" }, + "keywords": [ + "observablehq", + "markdown", + "observable", + "compiler", + "interpreter", + "renderer" + ], "author": "Gordon Smith ", "contributors": [], "license": "Apache-2.0", @@ -76,4 +67,4 @@ "url": "https://github.com/hpcc-systems/Visualization/issues" }, "homepage": "https://github.com/hpcc-systems/Visualization/tree/trunk/packages/observablehq-compiler" -} +} \ No newline at end of file diff --git a/packages/observablehq-compiler/rollup.config.mjs b/packages/observablehq-compiler/rollup.config.mjs deleted file mode 100644 index 1ae3d1cddb..0000000000 --- a/packages/observablehq-compiler/rollup.config.mjs +++ /dev/null @@ -1,62 +0,0 @@ -import { external, globals } from "@hpcc-js/bundle"; -import alias from "@rollup/plugin-alias"; -import commonjs from "@rollup/plugin-commonjs"; -import sourcemaps from "rollup-plugin-sourcemaps"; -import nodeResolve from "@rollup/plugin-node-resolve"; -import postcss from "rollup-plugin-postcss"; -import json from "@rollup/plugin-json"; - -import pkg from "./package.json" with { type: "json" }; - -const plugins = [ - json(), - alias({ - entries: [ - ] - }), - nodeResolve({ - preferBuiltins: true - }), - commonjs({}), - sourcemaps(), - postcss({ - extensions: [".css"], - extract: true, - minimize: true - }) -]; - -export default [{ - input: "lib-es6/index", - external: external, - output: [{ - file: pkg.main, - format: "umd", - sourcemap: true, - globals: globals, - name: pkg.name, - plugins: [] - }, { - file: pkg.module, - format: "es", - sourcemap: true, - globals: globals - }], - treeshake: { - moduleSideEffects: [] - }, - plugins -}, { - input: "lib-es6/__tests__/index", - external: external, - output: [{ - file: "dist-test/index.mjs", - format: "es", - sourcemap: true, - globals: globals, - name: pkg.name - }], - plugins: [ - ...plugins, - ] -}]; \ No newline at end of file diff --git a/packages/observablehq-compiler/src/__tests__/File Attachments.ts b/packages/observablehq-compiler/spec/File Attachments.ts similarity index 100% rename from packages/observablehq-compiler/src/__tests__/File Attachments.ts rename to packages/observablehq-compiler/spec/File Attachments.ts diff --git a/packages/observablehq-compiler/src/__tests__/Introduction to Imports.ts b/packages/observablehq-compiler/spec/Introduction to Imports.ts similarity index 100% rename from packages/observablehq-compiler/src/__tests__/Introduction to Imports.ts rename to packages/observablehq-compiler/spec/Introduction to Imports.ts diff --git a/packages/observablehq-compiler/src/__tests__/Observable TimeChart.ts b/packages/observablehq-compiler/spec/Observable TimeChart.ts similarity index 100% rename from packages/observablehq-compiler/src/__tests__/Observable TimeChart.ts rename to packages/observablehq-compiler/spec/Observable TimeChart.ts diff --git a/packages/observablehq-compiler/spec/browser.ts b/packages/observablehq-compiler/spec/browser.ts new file mode 100644 index 0000000000..0fbf846a35 --- /dev/null +++ b/packages/observablehq-compiler/spec/browser.ts @@ -0,0 +1,193 @@ +import { Library, Runtime, Inspector } from "@observablehq/runtime"; +import { expect } from "chai"; +import { compile, download, ohq, ojs2notebook } from "@hpcc-js/observablehq-compiler"; +import { fa } from "./File Attachments.ts"; +import { imports } from "./Introduction to Imports.ts"; +import { timechart } from "./Observable TimeChart.ts"; + +const link = globalThis.document.createElement('link'); +link.rel = 'stylesheet'; +link.href = './__moduleRoot__/dist/index.css'; +document.head.appendChild(link); + +const placeholder = globalThis.document.createElement("div"); +globalThis.document.body.appendChild(placeholder); + +const ojs = ` +42; +a = 1 +b = 2 +c = a + b +d = { + yield 1; + yield 2; + yield 3; +} + +viewof e = { + let output = {}; + let listeners = []; + output.value = 10; + output.addEventListener = (listener) => listeners.push(listener);; + output.removeEventListener = (listener) => { + listeners = listeners.filter(l => l !== listener); + }; + return output; +} + +tenTimes = { + for (let i = 0; i < 10; i++) { + yield Promises.delay(100); + } +} + +f = { + tenTimes; + return (this || 0) + 1; +} +`; + +describe("ojs", function () { + it("quickstart", async function () { + + const notebook = await download("https://observablehq.com/@observablehq/summary-table"); + const compiledNB = await compile(notebook); + + const library = new Library(); + const runtime = new Runtime(library); + + compiledNB(runtime, name => { + const div = globalThis?.document.createElement("div"); + placeholder.appendChild(div); + return new Inspector(div); + }); + }); + + it("simple", async function () { + + const notebook = ojs2notebook(ojs); + const define = await compile(notebook); + + const library = new Library(); + const runtime = new Runtime(library); + const main: ohq.Module = define(runtime, name => { + if (placeholder) { + const div = globalThis?.document.createElement("div"); + placeholder.appendChild(div); + return new Inspector(div); + } + return { + pending() { }, + fulfilled(value) { console.info("fulfilled", name, value); }, + rejected(error) { console.error("rejected", name, error); }, + }; + }); + + expect(await main.value("d")).to.equal(1); + expect(await main.value("d")).to.equal(2); + expect(await main.value("d")).to.equal(3); + expect(await main.value("d")).to.equal(3); + expect(await main.value("d")).to.equal(3); + + expect(await main.value("c")).to.equal(3); + expect(await main.value("a")).to.equal(1); + expect(await main.value("b")).to.equal(2); + + expect(await main.value("e")).to.equal(10); + const viewOfE = await main.value("viewof e"); + expect(viewOfE).to.have.property("value"); + expect(viewOfE).to.have.property("addEventListener"); + expect(viewOfE).to.have.property("removeEventListener"); + + await main.value("tenTimes"); + + for (const cellID in define.cells) { + define.delete(cellID); + break; + } + }); + + it("File Attachements", async function () { + + const define = await compile(fa as any); + + const library = new Library(); + const runtime = new Runtime(library); + const main: ohq.Module = define(runtime, name => { + if (placeholder) { + const div = globalThis?.document.createElement("div"); + placeholder.appendChild(div); + return new Inspector(div); + } + return { + pending() { console.info("pending", name); }, + fulfilled(value) { console.info("fulfilled", name, value); }, + rejected(error) { console.error("rejected", name, error); }, + }; + }); + expect(main).to.be.an("object"); + }); + + it("esm imports", async function () { + + const define = await compile(`\ +m1 = import("../spec/m1.mjs"); +x = m1.f(5, 7); +`); + + const library = new Library(); + const runtime = new Runtime(library); + const main: ohq.Module = define(runtime, name => { + return { + pending() { }, + fulfilled(value) { console.info("fulfilled", name, value); }, + rejected(error) { console.error("rejected", name, error); }, + }; + }); + expect(main).to.be.an("object"); + expect(await main.value("x")).to.equal(35); + }); + + it("Introduction to Imports", async function () { + + const define = await compile(imports as any); + + const library = new Library(); + const runtime = new Runtime(library); + const main: ohq.Module = define(runtime, name => { + if (placeholder) { + const div = globalThis?.document.createElement("div"); + placeholder.appendChild(div); + return new Inspector(div); + } + return { + pending() { console.info("pending", name); }, + fulfilled(value) { console.info("fulfilled", name, value); }, + rejected(error) { console.error("rejected", name, error); }, + }; + }); + expect(main).to.be.an("object"); + }); + + it("Observable TimeChart", async function () { + + const define2 = await compile(timechart as any); + + const library = new Library(); + const runtime = new Runtime(library); + const main: ohq.Module = define2(runtime, name => { + if (placeholder) { + const div = globalThis?.document.createElement("div"); + placeholder.appendChild(div); + return new Inspector(div); + } + return { + pending() { console.info("pending", name); }, + fulfilled(value) { console.info("fulfilled", name, value); }, + rejected(error) { console.error("rejected", name, error); }, + }; + }); + expect(main).to.be.an("object"); + }); +}); + diff --git a/packages/observablehq-compiler/spec/index.browser.ts b/packages/observablehq-compiler/spec/index.browser.ts new file mode 100644 index 0000000000..14fe409ff1 --- /dev/null +++ b/packages/observablehq-compiler/spec/index.browser.ts @@ -0,0 +1,4 @@ +jasmine.DEFAULT_TIMEOUT_INTERVAL = 30000; + +import "./index.ts"; +import "./browser.ts"; diff --git a/packages/observablehq-compiler/spec/index.node.ts b/packages/observablehq-compiler/spec/index.node.ts new file mode 100644 index 0000000000..bd6743c16d --- /dev/null +++ b/packages/observablehq-compiler/spec/index.node.ts @@ -0,0 +1,2 @@ +import "./index.ts"; +import "./node.ts"; diff --git a/packages/observablehq-compiler/spec/index.ts b/packages/observablehq-compiler/spec/index.ts new file mode 100644 index 0000000000..edcb6d4eb0 --- /dev/null +++ b/packages/observablehq-compiler/spec/index.ts @@ -0,0 +1,25 @@ +import { expect } from "chai"; +import { Library, Runtime } from "@observablehq/runtime"; +import { compile, ohq } from "@hpcc-js/observablehq-compiler"; + +describe("observablehq-compiler", function () { + it("esm imports", async function () { + + const define = await compile(`\ +m1 = import("../spec/m1.mjs"); +x = m1.f(5, 7); +`); + + const library = new Library(); + const runtime = new Runtime(library); + const main: ohq.Module = define(runtime, name => { + return { + pending() { }, + fulfilled(value) { console.info("fulfilled", name, value); }, + rejected(error) { console.error("rejected", name, error); }, + }; + }); + + expect(await main.value("x")).to.equal(35); + }); +}); diff --git a/packages/observablehq-compiler/spec/m1.mjs b/packages/observablehq-compiler/spec/m1.mjs new file mode 100644 index 0000000000..d9ea05c25b --- /dev/null +++ b/packages/observablehq-compiler/spec/m1.mjs @@ -0,0 +1,5 @@ +import { f2 as f3 } from "./m2.mjs"; + +export function f(a, b) { + return f3(a, b); +} diff --git a/packages/observablehq-compiler/spec/m2.mjs b/packages/observablehq-compiler/spec/m2.mjs new file mode 100644 index 0000000000..dd674ac6fb --- /dev/null +++ b/packages/observablehq-compiler/spec/m2.mjs @@ -0,0 +1,3 @@ +export function f2(a, b) { + return a * b; +} diff --git a/packages/observablehq-compiler/spec/node.ts b/packages/observablehq-compiler/spec/node.ts new file mode 100644 index 0000000000..e6d64a92b7 --- /dev/null +++ b/packages/observablehq-compiler/spec/node.ts @@ -0,0 +1,12 @@ +import { compile, Writer } from "@hpcc-js/observablehq-compiler"; +import { imports } from "./Introduction to Imports.ts"; + +describe("observablehq-compiler-node", function () { + it("writer", async function () { + const writer = new Writer(); + const define = await compile(imports as any); + define.write(writer); + console.info(writer.toString()); + }); +}); + diff --git a/packages/observablehq-compiler/spec/support/jasmine-browser.mjs b/packages/observablehq-compiler/spec/support/jasmine-browser.mjs new file mode 100644 index 0000000000..37205c1a08 --- /dev/null +++ b/packages/observablehq-compiler/spec/support/jasmine-browser.mjs @@ -0,0 +1,28 @@ +import pkg from "../../package.json" with {type: "json"}; + +export default { + srcDir: "src", + srcFiles: [ + "**/*.ts" + ], + specDir: "dist-test", + specFiles: [ + "*.browser.js" + ], + esmFilenameExtension: ".js", + importMap: { + imports: { + [pkg.name]: "dist/index.js" + } + }, + env: { + stopSpecOnExpectationFailure: false, + stopOnSpecFailure: false, + random: false + }, + listenAddress: "localhost", + hostname: "localhost", + browser: { + name: "headlessFirefox" + } +}; diff --git a/packages/observablehq-compiler/spec/support/jasmine.json b/packages/observablehq-compiler/spec/support/jasmine.json new file mode 100644 index 0000000000..2ac6faaf94 --- /dev/null +++ b/packages/observablehq-compiler/spec/support/jasmine.json @@ -0,0 +1,10 @@ +{ + "spec_dir": "dist-test", + "spec_files": [ + "index.node.js" + ], + "env": { + "stopSpecOnExpectationFailure": false, + "random": false + } +} \ No newline at end of file diff --git a/packages/observablehq-compiler/src/__tests__/index.ts b/packages/observablehq-compiler/src/__tests__/index.ts deleted file mode 100644 index 8016f49179..0000000000 --- a/packages/observablehq-compiler/src/__tests__/index.ts +++ /dev/null @@ -1,13 +0,0 @@ -// @ts-ignore -import fetch, { Blob, blobFrom, blobFromSync, File, fileFrom, fileFromSync, FormData, Headers, Request, Response } from "node-fetch"; -if (!globalThis.fetch) { - // @ts-ignore - globalThis.fetch = fetch; - // @ts-ignore - globalThis.Headers = Headers; - // @ts-ignore - globalThis.Request = Request; - // @ts-ignore - globalThis.Response = Response; -} -export * from "./node"; diff --git a/packages/observablehq-compiler/src/__tests__/m1.mjs b/packages/observablehq-compiler/src/__tests__/m1.mjs deleted file mode 100644 index 0db753ff95..0000000000 --- a/packages/observablehq-compiler/src/__tests__/m1.mjs +++ /dev/null @@ -1,3 +0,0 @@ -export function f(a, b) { - return a * b; -} diff --git a/packages/observablehq-compiler/src/__tests__/node.ts b/packages/observablehq-compiler/src/__tests__/node.ts deleted file mode 100644 index 513c022115..0000000000 --- a/packages/observablehq-compiler/src/__tests__/node.ts +++ /dev/null @@ -1,199 +0,0 @@ -import { Library, Runtime, Inspector } from "@observablehq/runtime"; -import { expect } from "chai"; -import { compile, download, ohq, ojs2notebook } from "../index"; -import { Writer } from "../writer"; -import { fa } from "./File Attachments"; -import { imports } from "./Introduction to Imports"; -import { timechart } from "./Observable TimeChart"; - -const placeholder = globalThis?.document?.getElementById("placeholder"); - -const ojs = ` -42; -a = 1 -b = 2 -c = a + b -d = { - yield 1; - yield 2; - yield 3; -} - -viewof e = { - let output = {}; - let listeners = []; - output.value = 10; - output.addEventListener = (listener) => listeners.push(listener);; - output.removeEventListener = (listener) => { - listeners = listeners.filter(l => l !== listener); - }; - return output; -} - -tenTimes = { - for (let i = 0; i < 10; i++) { - yield Promises.delay(100); - } -} - -f = { - tenTimes; - return (this || 0) + 1; -} -`; - -describe("ojs", function () { - it("quickstart", async function () { - this.timeout(10000); - - const notebook = await download("https://observablehq.com/@observablehq/summary-table"); - const compiledNB = await compile(notebook); - - const library = new Library(); - const runtime = new Runtime(library); - - compiledNB(runtime, name => { - const div = globalThis?.document.createElement("div"); - placeholder.appendChild(div); - return new Inspector(div); - }); - }); - - it("simple", async function () { - this.timeout(10000); - - const notebook = ojs2notebook(ojs); - const define = await compile(notebook); - - const library = new Library(); - const runtime = new Runtime(library); - const main: ohq.Module = define(runtime, name => { - if (placeholder) { - const div = globalThis?.document.createElement("div"); - placeholder.appendChild(div); - return new Inspector(div); - } - return { - pending() { }, - fulfilled(value) { console.info("fulfilled", name, value); }, - rejected(error) { console.error("rejected", name, error); }, - }; - }); - - expect(await main.value("d")).to.equal(1); - expect(await main.value("d")).to.equal(2); - expect(await main.value("d")).to.equal(3); - expect(await main.value("d")).to.equal(3); - expect(await main.value("d")).to.equal(3); - - expect(await main.value("c")).to.equal(3); - expect(await main.value("a")).to.equal(1); - expect(await main.value("b")).to.equal(2); - - expect(await main.value("e")).to.equal(10); - const viewOfE = await main.value("viewof e"); - expect(viewOfE).to.have.property("value"); - expect(viewOfE).to.have.property("addEventListener"); - expect(viewOfE).to.have.property("removeEventListener"); - - await main.value("tenTimes"); - - for (const cellID in define.cells) { - define.delete(cellID); - break; - } - }); - - it("compiler", async function () { - const writer = new Writer(); - const define = await compile(imports as any); - define.write(writer); - console.info(writer.toString()); - }); - - it("File Attachements", async function () { - - const define = await compile(fa as any); - - const library = new Library(); - const runtime = new Runtime(library); - /*const main: ohq.Module =*/ define(runtime, name => { - if (placeholder) { - const div = globalThis?.document.createElement("div"); - placeholder.appendChild(div); - return new Inspector(div); - } - return { - pending() { console.info("pending", name); }, - fulfilled(value) { console.info("fulfilled", name, value); }, - rejected(error) { console.error("rejected", name, error); }, - }; - }); - - }); - - it("esm imports", async function () { - this.timeout(10000); - - const define = await compile(`\ -m1 = import("../src/__tests__/m1.mjs"); -x = m1.f(5, 7); -`); - - const library = new Library(); - const runtime = new Runtime(library); - const main: ohq.Module = define(runtime, name => { - return { - pending() { }, - fulfilled(value) { console.info("fulfilled", name, value); }, - rejected(error) { console.error("rejected", name, error); }, - }; - }); - - expect(await main.value("x")).to.equal(35); - - }); - - it("Introduction to Imports", async function () { - - const define = await compile(imports as any); - - const library = new Library(); - const runtime = new Runtime(library); - /*const main: ohq.Module =*/ define(runtime, name => { - if (placeholder) { - const div = globalThis?.document.createElement("div"); - placeholder.appendChild(div); - return new Inspector(div); - } - return { - pending() { console.info("pending", name); }, - fulfilled(value) { console.info("fulfilled", name, value); }, - rejected(error) { console.error("rejected", name, error); }, - }; - }); - - }); - - it("Observable TimeChart", async function () { - - const define2 = await compile(timechart as any); - - const library = new Library(); - const runtime = new Runtime(library); - /*const main: ohq.Module =*/ define2(runtime, name => { - if (placeholder) { - const div = globalThis?.document.createElement("div"); - placeholder.appendChild(div); - return new Inspector(div); - } - return { - pending() { console.info("pending", name); }, - fulfilled(value) { console.info("fulfilled", name, value); }, - rejected(error) { console.error("rejected", name, error); }, - }; - }); - - }); -}); - diff --git a/packages/observablehq-compiler/src/compiler.ts b/packages/observablehq-compiler/src/compiler.ts index d36d260f62..7d2ef4516c 100644 --- a/packages/observablehq-compiler/src/compiler.ts +++ b/packages/observablehq-compiler/src/compiler.ts @@ -1,16 +1,16 @@ import { ohq, splitModule } from "@hpcc-js/observable-shim"; -import { parseCell, ParsedImportCell } from "./cst"; -import { Writer } from "./writer"; -import { fixRelativeUrl, isRelativePath, encodeBacktick, fetchEx, obfuscatedImport, ojs2notebook, omd2notebook } from "./util"; +import { parseCell, ParsedImportCell } from "./cst.ts"; +import { Writer } from "./writer.ts"; +import { fixRelativeUrl, isRelativePath, encodeBacktick, fetchEx, obfuscatedImport, ojs2notebook, omd2notebook } from "./util.ts"; // Inspector Factory --- export type InspectorFactoryEx = (name: string | undefined, id: string | number) => Inspector; export interface Inspector { _node?: HTMLDivElement; - pending(); - fulfilled(value); - rejected(error); + pending(): void; + fulfilled(value: any): void; + rejected(error: Error): void; } // Module --- @@ -31,6 +31,9 @@ async function importFile(relativePath: string, baseUrl: string) { notebook = ojs2notebook(content); } else if (relativePath.endsWith(".omd")) { notebook = omd2notebook(content); + } else { + console.warn(`Unknown file type: ${relativePath}, assuming .ojsnb`); + notebook = JSON.parse(content); } const retVal: ImportDefine = compile(notebook, { baseUrl }) as any; retVal.delete = () => { }; @@ -44,7 +47,7 @@ async function importFile(relativePath: string, baseUrl: string) { async function importCompiledNotebook(partial: string) { const url = `https://api.observablehq.com/${partial[0] === "@" ? partial : `d/${partial}`}.js?v=3`; let impMod = { - default: function (runtime: ohq.Runtime, inspector?: InspectorFactoryEx): ohq.Module { + default: function (runtime: ohq.Runtime, inspector?: InspectorFactoryEx): ohq.Module | undefined { return undefined; } as any }; @@ -80,7 +83,7 @@ async function importNotebook(partial: string) { async function createModule(node: ohq.Node, parsed: ParsedImportCell, text: string, { baseUrl, importMode }: CompileOptions) { const otherModule = isRelativePath(parsed.src) ? - await importFile(parsed.src, baseUrl) : + await importFile(parsed.src, baseUrl ?? "") : importMode === "recursive" ? await importNotebook(parsed.src) : await importCompiledNotebook(parsed.src); @@ -123,11 +126,13 @@ type ModuleFunc = Awaited>; // Variable --- function createVariable(node: ohq.Node, inspect: boolean, name?: string, inputs?: string[], definition?: any, inline = false) { - let i: ohq.Inspector; - let v: ohq.Variable; + let i: ohq.Inspector | undefined; + let v: ohq.Variable | undefined; const retVal = (module: ohq.Module, inspector?: InspectorFactoryEx) => { - i = inspect ? inspector(name, node.id) : undefined; + if (inspect && inspector) { + i = inspector(name, node.id); + } v = module.variable(i); if (arguments.length > 1) { try { @@ -137,9 +142,9 @@ function createVariable(node: ohq.Node, inspect: boolean, name?: string, inputs? } } if (node.pinned) { - v = module.variable(inspector(name, node.id)); + v = inspector ? module.variable(inspector(name, node.id)) : module.variable(); try { - v.define(undefined, ["md"], md => { + v.define(undefined, ["md"], (md: any) => { return md`\`\`\`js ${node.value} \`\`\``; @@ -174,13 +179,17 @@ ${node.value} } type VariableFunc = ReturnType; -function createImportVariable(name?: string, alias?: string) { +function createImportVariable(name: string, alias?: string) { let v: ohq.Variable; const retVal = (main: ohq.Module, otherModule: ohq.Module) => { v = main.variable(); - v.import(name, alias, otherModule); + if (alias === undefined) { + v.import(name, otherModule); + } else { + v.import(name, alias, otherModule); + } }; retVal.delete = () => { @@ -198,7 +207,7 @@ async function createCell(node: ohq.Node, options: CompileOptions) { const text = node.mode && node.mode !== "js" ? `${node.mode}\`${encodeBacktick(node.value)}\`` : node.value; const parsedModule = splitModule(text); for (const cell of parsedModule) { - const parsed = parseCell(cell.text, options.baseUrl); + const parsed = parseCell(cell.text, options.baseUrl ?? ""); switch (parsed.type) { case "import": modules.push(await createModule(node, parsed, cell.text, options)); @@ -217,8 +226,8 @@ async function createCell(node: ohq.Node, options: CompileOptions) { break; } } - } catch (e) { - variables.push(createVariable(node, true, undefined, [], e.message)); + } catch (e: any) { + variables.push(createVariable(node, true, undefined, [], e.message ?? "Unkown error")); } const retVal = (runtime: ohq.Runtime, main: ohq.Module, inspector?: InspectorFactoryEx) => { @@ -242,8 +251,11 @@ export type CellFunc = Awaited>; // File --- function createFile(file: ohq.File, options: CompileOptions): [string, any] { - function toString() { return globalThis.url; } - return [file.name, { url: new URL(fixRelativeUrl(file.url, options.baseUrl)), mimeType: file.mime_type, toString }]; + function toString() { + // TODO Double check url should not be URL? + return (globalThis as any).url ?? ""; + } + return [file.name, { url: new URL(fixRelativeUrl(file.url, options.baseUrl ?? "")), mimeType: file.mime_type, toString }]; } type FileFunc = ReturnType; @@ -277,7 +289,7 @@ export function notebook(_files: ohq.File[] = [], _cells: CellFunc[] = [], { bas cells.set(cell.id, cell); return cell; }; - retVal.get = (id: string | number): CellFunc => { + retVal.get = (id: string | number): CellFunc | undefined => { return cells.get(id); }; retVal.delete = (id: string | number): boolean => { diff --git a/packages/observablehq-compiler/src/cst.ts b/packages/observablehq-compiler/src/cst.ts index 86e30d8f16..c83b10961d 100644 --- a/packages/observablehq-compiler/src/cst.ts +++ b/packages/observablehq-compiler/src/cst.ts @@ -1,20 +1,18 @@ -import { parseCell as ohqParseCell } from "@hpcc-js/observable-shim"; -import { acorn, walk } from "@observablehq/parser"; -import { ancestor } from "acorn-walk"; +import { ancestor, parseCell as ohqParseCell, Cell, Node, walk, AncestorVisitors } from "@hpcc-js/observable-shim"; -import { fixRelativeUrl, createFunction, Refs } from "./util"; +import { fixRelativeUrl, createFunction, Refs } from "./util.ts"; -function calcRefs(cellAst, cellStr): Refs { +function calcRefs(cellAst: Cell, cellStr: string): Refs { if (cellAst.references === undefined) return { inputs: [], args: [], patches: [] }; - const dedup = {}; - cellAst.references.forEach(r => dedup[cellStr.substring(r.start, r.end)] = true); + const dedup: { [id: string]: boolean } = {}; + cellAst.references.forEach((r: any) => dedup[cellStr.substring(r.start, r.end)] = true); const retVal: Refs = { inputs: Object.keys(dedup), args: Object.keys(dedup).map(r => r.split(" ").join("_")), patches: [] }; - const pushPatch = (node, newText) => retVal.patches.push({ start: node.start - cellAst.body.start, end: node.end - cellAst.body.start, newText }); + const pushPatch = (node: Node, newText: string) => retVal.patches.push({ start: node.start - (cellAst.body?.start ?? 0), end: node.end - (cellAst.body?.start ?? 0), newText }); if (cellAst.body) { ancestor(cellAst.body, { Identifier(node) { @@ -22,23 +20,23 @@ function calcRefs(cellAst, cellStr): Refs { if (dedup[value]) { } }, - MutableExpression(node) { + MutableExpression(node: Node) { const value = cellStr.substring(node.start, node.end); const newText = value.split(" ").join("_") + ".value"; pushPatch(node, newText); }, - ViewExpression(node) { + ViewExpression(node: Node) { const value = cellStr.substring(node.start, node.end); const newText = value.split(" ").join("_"); pushPatch(node, newText); }, - ThisExpression(node, ancestors: acorn.Node[]) { + ThisExpression(node: Node, ancestors: Node[]) { const value = cellStr.substring(node.start, node.end); if (value === "this" && !ancestors.find(n => n.type === "FunctionExpression")) { pushPatch(node, "((this === globalThis || this === globalThis.window)? undefined : this?.valueOf())"); } } - } as acorn.AncestorVisitors, walk); + } as AncestorVisitors, walk); } return retVal; } @@ -54,18 +52,18 @@ export interface ParsedImportCell extends ParsedCell { injections: { name: string, alias: string }[]; } -function parseImportDeclaration(cellAst): ParsedImportCell { +function parseImportDeclaration(cellAst: any): ParsedImportCell { return { type: "import", src: cellAst.body.source.value, - specifiers: cellAst.body.specifiers?.map(spec => { + specifiers: cellAst.body.specifiers?.map((spec: any) => { return { view: spec.view, name: spec.imported.name, alias: (spec.local?.name && spec.imported.name !== spec.local.name) ? spec.local.name : spec.imported.name }; }) ?? [], - injections: cellAst.body.injections?.map(inj => { + injections: cellAst.body.injections?.map((inj: any) => { return { name: inj.imported.name, alias: inj.local?.name ?? inj.imported.name @@ -87,7 +85,7 @@ export interface ParsedViewCell extends ParsedCell { variableValue: ParsedVariable; } -function parseViewExpression(cellStr: string, cellAst, refs: Refs, bodyStr?: string): ParsedViewCell { +function parseViewExpression(cellStr: string, cellAst: any, refs: Refs, bodyStr?: string): ParsedViewCell { const id = cellAst.id && cellStr.substring(cellAst.id.start, cellAst.id.end); return { type: "viewof", @@ -101,7 +99,7 @@ function parseViewExpression(cellStr: string, cellAst, refs: Refs, bodyStr?: str type: "variable", id: cellAst?.id?.id?.name, inputs: ["Generators", id], - func: (G, _) => G.input(_) + func: (G: any, _: any) => G.input(_) } }; } @@ -113,7 +111,7 @@ interface ParsedMutableCell extends ParsedCell { variableValue: ParsedVariable; } -function parseMutableExpression(cellStr: string, cellAst, refs: Refs, bodyStr?: string): ParsedMutableCell { +function parseMutableExpression(cellStr: string, cellAst: any, refs: Refs, bodyStr?: string): ParsedMutableCell { const id = cellAst.id && cellStr.substring(cellAst.id.start, cellAst.id.end); const initialValueId = cellAst?.id?.id?.name; const initialId = `initial ${initialValueId}`; @@ -129,13 +127,13 @@ function parseMutableExpression(cellStr: string, cellAst, refs: Refs, bodyStr?: type: "variable", id, inputs: ["Mutable", initialId], - func: (M, _) => new M(_) + func: (M: any, _: any) => new M(_) }, variableValue: { type: "variable", id: initialValueId, inputs: [id], - func: _ => _.generator + func: (_: any) => _.generator } }; } @@ -147,7 +145,7 @@ interface ParsedVariableCell extends ParsedCell { func: any, } -function parseVariableExpression(cellStr: string, cellAst, refs: Refs, bodyStr?: string): ParsedVariableCell { +function parseVariableExpression(cellStr: string, cellAst: any, refs: Refs, bodyStr?: string): ParsedVariableCell { return { type: "variable", id: cellAst.id && cellStr.substring(cellAst.id?.start, cellAst.id?.end), @@ -163,10 +161,15 @@ export function parseCell(cellStr: string, baseUrl: string): ParsedImportCell | case "ImportDeclaration": return parseImportDeclaration(cellAst); case "ImportExpression": - bodyStr = `import("${fixRelativeUrl(cellAst.body.source.value, baseUrl)}")`; + switch (cellAst.body.source.type) { + case "Literal": + bodyStr = `import("${fixRelativeUrl("" + cellAst.body.source.value, baseUrl)}")`; + break; + default: + console.error("Unexpected import value"); + } } const refs = calcRefs(cellAst, cellStr); - switch (cellAst.id?.type) { case "ViewExpression": return parseViewExpression(cellStr, cellAst, refs, bodyStr); @@ -176,3 +179,4 @@ export function parseCell(cellStr: string, baseUrl: string): ParsedImportCell | return parseVariableExpression(cellStr, cellAst, refs, bodyStr); } } + diff --git a/packages/observablehq-compiler/src/index.ts b/packages/observablehq-compiler/src/index.ts index d5dab1cc02..faefc0d3bd 100644 --- a/packages/observablehq-compiler/src/index.ts +++ b/packages/observablehq-compiler/src/index.ts @@ -1,6 +1,7 @@ export type { ohq } from "@hpcc-js/observable-shim"; -export * from "./compiler"; -export { ojs2notebook, omd2notebook, download } from "./util"; +export * from "./compiler.ts"; +export { ojs2notebook, omd2notebook, download } from "./util.ts"; +export * from "./writer.ts"; import "../src/index.css"; diff --git a/packages/observablehq-compiler/src/util.ts b/packages/observablehq-compiler/src/util.ts index 0bdf51a04e..890c16471f 100644 --- a/packages/observablehq-compiler/src/util.ts +++ b/packages/observablehq-compiler/src/util.ts @@ -41,7 +41,7 @@ export function createFunction(refs: Refs, async = false, generator = false, blo `return (\n${body}\n);`); } -function join(baseURL, relativeURL) { +function join(baseURL: string, relativeURL: string) { return relativeURL ? baseURL.replace(/\/+$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL; @@ -159,6 +159,9 @@ export function omd2notebook(omd: string): ohq.Notebook { export function fetchEx(url: string, proxyPrefix = "https://api.codetabs.com/v1/proxy/?quest=", proxyPostfix = "") { const matches = url.match(/^(?:https?:\/\/)?(?:[^@\n]+@)?(?:www\.)?([^:\/\n?]+)/img); + if (!matches || matches.length === 0) { + throw new Error(`Invalid URL: ${url}`); + } return fetch(url, { headers: { origin: matches[0], referer: url } }).then(response => { if (response.ok) return response; throw new Error("CORS?"); diff --git a/packages/observablehq-compiler/src/writer.ts b/packages/observablehq-compiler/src/writer.ts index 4ec14cafa0..c178cfbf9a 100644 --- a/packages/observablehq-compiler/src/writer.ts +++ b/packages/observablehq-compiler/src/writer.ts @@ -1,5 +1,5 @@ import { ohq } from "@hpcc-js/observable-shim"; -import { ParsedImportCell, ParsedVariable } from "./cst"; +import { ParsedImportCell, ParsedVariable } from "./cst.ts"; export class Writer { @@ -43,14 +43,16 @@ export default function define(runtime, observer) { } importDefine(imp: Partial) { - const injections = imp.injections.map(inj => { + const impInjections = imp.injections ?? []; + const injections = impInjections.map(inj => { return inj.name === inj.alias ? `"${inj.name}"` : `{name: "${inj.name}", alias: "${inj.alias}"}`; }); - const derive = imp.injections.length ? `.derive([${injections.join(", ")}], main)` : ""; + const derive = impInjections.length ? `.derive([${injections.join(", ")}], main)` : ""; this._defines.push(`const child${this._defineUid} = runtime.module(define${this._defineUid})${derive};`); - imp.specifiers.forEach(s => { + const impSpecifiers = imp.specifiers ?? []; + impSpecifiers.forEach(s => { this._defines.push(`main.import("${s.name}"${s.alias && s.alias !== s.name ? `, "${s.alias}"` : ""}, child${this._defineUid}); `); }); } @@ -67,7 +69,8 @@ export default function define(runtime, observer) { funcId = funcId ?? variable.id; const observe = observable ? `.variable(observer(${variable.id ? JSON.stringify(variable.id) : ""}))` : ""; const id = variable.id ? `${JSON.stringify(variable.id)}, ` : ""; - const inputs = variable.inputs.length ? `[${variable.inputs.map(i => JSON.stringify(i)).join(", ")}], ` : ""; + const variableInputs = variable.inputs ?? []; + const inputs = variableInputs.length ? `[${variableInputs.map(i => JSON.stringify(i)).join(", ")}], ` : ""; const func = inlineFunc ? variable.func?.toString() : funcId; diff --git a/packages/observablehq-compiler/tsconfig.json b/packages/observablehq-compiler/tsconfig.json index bb5736022c..01dec5ab90 100644 --- a/packages/observablehq-compiler/tsconfig.json +++ b/packages/observablehq-compiler/tsconfig.json @@ -1,20 +1,22 @@ { - "extends": "../tsconfig.settings.json", "compilerOptions": { - "rootDir": "./src", - "outDir": "./lib-umd", - "declarationDir": "./types", - "target": "ES2018", - "noImplicitThis": true, + "rootDir": "src", + "module": "NodeNext", + "target": "ESNext", + "resolveJsonModule": true, + "emitDeclarationOnly": true, + "declaration": true, + "declarationDir": "types", + "strict": true, + "skipLibCheck": true, + "allowImportingTsExtensions": true, "lib": [ - "dom", - "ES2018" - ], - "types": [ - "mocha" + "DOM", + "ESNext", + "ES2020" ] }, "include": [ - "./src/**/*" + "./src/index.ts" ] } \ No newline at end of file diff --git a/packages/observablehq-compiler/tsconfig.spec.json b/packages/observablehq-compiler/tsconfig.spec.json new file mode 100644 index 0000000000..cfd3249890 --- /dev/null +++ b/packages/observablehq-compiler/tsconfig.spec.json @@ -0,0 +1,16 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "rootDir": ".", + "noEmit": true, + "emitDeclarationOnly": false, + "noImplicitAny": false, + "types": [ + "jasmine" + ] + }, + "include": [ + "./spec/index.browser.ts", + "./spec/index.node.ts" + ] +} \ No newline at end of file diff --git a/packages/phosphor/tsconfig.json b/packages/phosphor/tsconfig.json index 4c258546b1..d43d90596f 100644 --- a/packages/phosphor/tsconfig.json +++ b/packages/phosphor/tsconfig.json @@ -18,8 +18,5 @@ { "path": "../phosphor-shim" }, - { - "path": "../util" - } ] } \ No newline at end of file diff --git a/packages/util/.vscode/launch.json b/packages/util/.vscode/launch.json new file mode 100644 index 0000000000..3ee32e4122 --- /dev/null +++ b/packages/util/.vscode/launch.json @@ -0,0 +1,33 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "test-browser", + "type": "msedge", + "request": "launch", + "url": "http://localhost:8888", + "webRoot": "${workspaceFolder}", + "outFiles": [ + "${workspaceFolder}/**/*.js", + "!**/node_modules/**" + ], + }, + { + "name": "test-node", + "type": "node", + "request": "launch", + "runtimeArgs": [ + "run-script", + "test-node" + ], + "runtimeExecutable": "npm", + "skipFiles": [ + "/**" + ], + "outFiles": [ + "${workspaceFolder}/**/*.js", + "!**/node_modules/**" + ], + } + ] +} \ No newline at end of file diff --git a/packages/util/.vscode/tasks.json b/packages/util/.vscode/tasks.json index 79e20d2523..a046004a24 100644 --- a/packages/util/.vscode/tasks.json +++ b/packages/util/.vscode/tasks.json @@ -2,9 +2,9 @@ "version": "2.0.0", "tasks": [ { - "label": "es6 watch", + "label": "check-watch", "type": "npm", - "script": "compile-es6-watch", + "script": "check-watch", "problemMatcher": [ "$tsc-watch" ], @@ -13,9 +13,9 @@ } }, { - "label": "umd watch", + "label": "gen-types-watch", "type": "npm", - "script": "compile-umd-watch", + "script": "gen-types-watch", "problemMatcher": [ "$tsc-watch" ], @@ -24,7 +24,7 @@ } }, { - "label": "bundle watch", + "label": "bundle-watch", "type": "npm", "script": "bundle-watch", "problemMatcher": [], @@ -32,18 +32,26 @@ "group": "group-build" } }, + { + "type": "npm", + "label": "test-serve", + "script": "test-serve", + "presentation": { + "group": "group-build" + } + }, { "label": "build", "dependsOn": [ - "es6 watch", - "umd watch", - "bundle watch" + "check-watch", + "gen-types-watch", + "bundle-watch", + "test-serve" ], "group": { "kind": "build", "isDefault": true - }, - "problemMatcher": [] + } } ] } \ No newline at end of file diff --git a/packages/util/esbuild.js b/packages/util/esbuild.js new file mode 100644 index 0000000000..ed3741d615 --- /dev/null +++ b/packages/util/esbuild.js @@ -0,0 +1,9 @@ +import { browserTpl, neutralTpl, nodeTpl } from "@hpcc-js/esbuild-plugins"; + +// config --- +await neutralTpl("src/index.ts", "dist/index"); +await Promise.all([ + browserTpl("spec/index.browser.ts", "dist-test/index.browser", undefined, undefined, undefined, ["@hpcc-js/*"]), + nodeTpl("spec/index.node.ts", "dist-test/index.node", undefined, undefined, undefined, ["@hpcc-js/*"]), +]); + diff --git a/packages/util/package.json b/packages/util/package.json index 127fe00942..99383f7808 100644 --- a/packages/util/package.json +++ b/packages/util/package.json @@ -2,47 +2,44 @@ "name": "@hpcc-js/util", "version": "2.52.0", "description": "hpcc-js - Utilities", - "main": "dist/index.js", - "module": "lib-es6/index", - "unpkg": "dist/index.min.js", - "jsdelivr": "dist/index.min.js", - "types": "types/index.d.ts", - "typesVersions": { - "<3.8": { - "*": [ - "types-3.4/index.d.ts" - ] + "type": "module", + "exports": { + ".": { + "types": "./types/index.d.ts", + "default": "./dist/index.js" } }, + "main": "./dist/index.js", + "types": "./types/index.d.ts", "files": [ - "types/*", - "types-3.4/*", - "lib-es6/*", + "dist/*", "src/*", - "dist/*" + "types/*" ], "scripts": { - "clean": "rimraf --glob lib* types dist *.tsbuildinfo", - "compile-es6": "tsc --module es6 --outDir ./lib-es6", - "compile-es6-watch": "npm run compile-es6 -- -w", - "compile-umd": "tsc --module umd --outDir ./lib-umd", - "compile-umd-watch": "npm run compile-umd -- -w", - "bundle": "rollup -c", - "bundle-watch": "npm run bundle -- -w", - "minimize": "terser dist/index.js -c -m --source-map \"content='dist/index.js.map',url='index.min.js.map'\" -o dist/index.min.js", - "gen-legacy-types": "downlevel-dts ./types ./types-3.4", - "build": "npm run compile-es6 && npm run bundle", - "watch": "npm-run-all compile-es6 -p compile-es6-watch bundle-watch", + "clean": "rimraf --glob lib* types dist dist-test *.tsbuildinfo .turbo", + "check": "tsc --project tsconfig.spec.json", + "check-watch": "npm run check -- --watch", + "bundle": "node esbuild.js", + "bundle-watch": "npm run bundle -- --development --watch", + "gen-types": "tsc --project tsconfig.json", + "gen-types-watch": "npm run gen-types -- --watch", + "build": "run-p gen-types bundle", "stamp": "node ../../node_modules/@hpcc-js/bundle/src/stamp.js", "lint": "eslint ./src", "docs": "typedoc --options tdoptions.json .", - "update": "npx --yes npm-check-updates -u -t minor" + "test-serve": "jasmine-browser-runner serve", + "test-browser": "jasmine-browser-runner runSpecs", + "test-node": "jasmine", + "test": "run-p check test-node test-browser", + "update": "npx -y npm-check-updates -u -t minor", + "update-major": "npx -y npm-check-updates -u" }, "dependencies": { - "tslib": "2.6.3" }, "devDependencies": { - "@hpcc-js/bundle": "^2.12.0" + "@hpcc-js/esbuild-plugins": "^1.1.2", + "@types/jasmine": "5.1.4" }, "repository": { "type": "git", @@ -54,5 +51,5 @@ "bugs": { "url": "https://github.com/hpcc-systems/Visualization/issues" }, - "homepage": "https://github.com/hpcc-systems/Visualization" -} + "homepage": "https://github.com/hpcc-systems/Visualization/tree/trunk/packages/util" +} \ No newline at end of file diff --git a/packages/util/rollup.config.mjs b/packages/util/rollup.config.mjs deleted file mode 100644 index 4b15e381c1..0000000000 --- a/packages/util/rollup.config.mjs +++ /dev/null @@ -1,32 +0,0 @@ -import { external, globals } from "@hpcc-js/bundle"; -import alias from '@rollup/plugin-alias'; -import commonjs from '@rollup/plugin-commonjs'; -import sourcemaps from 'rollup-plugin-sourcemaps'; -import nodeResolve from '@rollup/plugin-node-resolve'; -import postcss from "rollup-plugin-postcss"; - -import pkg from "./package.json" with { type: "json" }; - -export default { - input: "lib-es6/index", - external: external, - output: [{ - file: pkg.main, - format: "umd", - sourcemap: true, - globals: globals, - name: pkg.name - }], - plugins: [ - alias({}), - nodeResolve({ - preferBuiltins: true - }), - commonjs({}), - sourcemaps(), - postcss({ - extensions: [".css"], - minimize: true - }) - ] -}; \ No newline at end of file diff --git a/tests/test-util/src/array.spec.ts b/packages/util/spec/array.ts similarity index 100% rename from tests/test-util/src/array.spec.ts rename to packages/util/spec/array.ts diff --git a/tests/test-util/src/cache.spec.ts b/packages/util/spec/cache.ts similarity index 97% rename from tests/test-util/src/cache.spec.ts rename to packages/util/spec/cache.ts index bd85fcbe7a..6dd09560d2 100644 --- a/tests/test-util/src/cache.spec.ts +++ b/packages/util/spec/cache.ts @@ -33,7 +33,7 @@ describe("AsyncCache", function () { it("basic", async function () { class MyClass { id: string; - id2: string; + id2: string = ""; val: string = ""; constructor(id: string, id2: string) { @@ -54,7 +54,7 @@ describe("AsyncCache", function () { }); expect(myCache.has({ id: "007" })).is.false; let callbackCount = 0; - const promises = []; + const promises: Promise[] = []; for (let i = 0; i < 10; ++i) { promises.push(myCache.get({ id: "007" }, async () => { const retVal = new MyClass("007", "a"); diff --git a/tests/test-util/src/debounce.spec.ts b/packages/util/spec/debounce.ts similarity index 95% rename from tests/test-util/src/debounce.spec.ts rename to packages/util/spec/debounce.ts index 0e7499c2f1..b33494393a 100644 --- a/tests/test-util/src/debounce.spec.ts +++ b/packages/util/spec/debounce.ts @@ -41,15 +41,15 @@ describe("debounce", function () { funcHalfSec(); const elapsed = Date.now() - startTime; console.log(`elapsed - ${elapsed}`); - if (elapsed > 1500) { - expect(funcHalfSecCallCount).to.equal(4); + if (elapsed > 1600) { + expect(funcHalfSecCallCount).to.greaterThanOrEqual(4); clearInterval(interval); resolve(); - } else if (elapsed > 1000) { + } else if (elapsed > 1000 && elapsed <= 1500) { expect(funcHalfSecCallCount).to.equal(3); - } else if (elapsed > 500) { + } else if (elapsed > 500 && elapsed <= 1000) { expect(funcHalfSecCallCount).to.equal(2); - } else { + } else if (elapsed <= 500) { expect(funcHalfSecCallCount).to.equal(1); } }, 175); diff --git a/tests/test-util/src/dictionary.spec.ts b/packages/util/spec/dictionary.ts similarity index 100% rename from tests/test-util/src/dictionary.spec.ts rename to packages/util/spec/dictionary.ts diff --git a/tests/test-util/src/dts-bundle.ts b/packages/util/spec/dts-bundle.ts similarity index 100% rename from tests/test-util/src/dts-bundle.ts rename to packages/util/spec/dts-bundle.ts diff --git a/tests/test-util/src/esp.spec.ts b/packages/util/spec/esp.ts similarity index 100% rename from tests/test-util/src/esp.spec.ts rename to packages/util/spec/esp.ts diff --git a/tests/test-util/src/graph.spec.ts b/packages/util/spec/graph.ts similarity index 100% rename from tests/test-util/src/graph.spec.ts rename to packages/util/spec/graph.ts diff --git a/tests/test-util/src/graph2.spec.ts b/packages/util/spec/graph2.ts similarity index 100% rename from tests/test-util/src/graph2.spec.ts rename to packages/util/spec/graph2.ts diff --git a/packages/util/spec/index.browser.ts b/packages/util/spec/index.browser.ts new file mode 100644 index 0000000000..97a49e9a98 --- /dev/null +++ b/packages/util/spec/index.browser.ts @@ -0,0 +1,3 @@ +jasmine.DEFAULT_TIMEOUT_INTERVAL = 30000; + +import "./index.ts"; diff --git a/packages/util/spec/index.node.ts b/packages/util/spec/index.node.ts new file mode 100644 index 0000000000..07591ae9d8 --- /dev/null +++ b/packages/util/spec/index.node.ts @@ -0,0 +1 @@ +import "./index.ts"; diff --git a/packages/util/spec/index.ts b/packages/util/spec/index.ts new file mode 100644 index 0000000000..8e9e310b03 --- /dev/null +++ b/packages/util/spec/index.ts @@ -0,0 +1,16 @@ +import "./array.ts"; +import "./cache.ts"; +import "./debounce.ts"; +import "./dictionary.ts"; +import "./esp.ts"; +import "./graph.ts"; +import "./graph2.ts"; +import "./logging.ts"; +import "./object.ts"; +import "./observer.ts"; +import "./platform.ts"; +import "./stack.ts"; +import "./stateful.ts"; +import "./string.ts"; +import "./url.ts"; +import "./xmldom.ts"; diff --git a/tests/test-util/src/logging.spec.ts b/packages/util/spec/logging.ts similarity index 100% rename from tests/test-util/src/logging.spec.ts rename to packages/util/spec/logging.ts diff --git a/tests/test-util/src/math.spec.ts b/packages/util/spec/math.ts similarity index 100% rename from tests/test-util/src/math.spec.ts rename to packages/util/spec/math.ts diff --git a/tests/test-util/src/object.spec.ts b/packages/util/spec/object.ts similarity index 100% rename from tests/test-util/src/object.spec.ts rename to packages/util/spec/object.ts diff --git a/tests/test-util/src/observer.spec.ts b/packages/util/spec/observer.ts similarity index 84% rename from tests/test-util/src/observer.spec.ts rename to packages/util/spec/observer.ts index 920c519e70..dcc519a59d 100644 --- a/tests/test-util/src/observer.spec.ts +++ b/packages/util/spec/observer.ts @@ -39,35 +39,35 @@ describe("observer", function () { }); }); -describe("observer2", function () { - class SimpleMessage extends Message { - constructor(readonly property: string, public newValue: any, public oldValue?: any) { - super(); - } +class SimpleMessage extends Message { + constructor(readonly property: string, public newValue: any, public oldValue?: any) { + super(); } +} - class ConflatingMessage extends Message { +class ConflatingMessage extends Message { - constructor(readonly property: string, public newValue: any, public oldValue?: any) { - super(); - } + constructor(readonly property: string, public newValue: any, public oldValue?: any) { + super(); + } - get canConflate(): boolean { return true; } - conflate(other: ConflatingMessage) { - if (this.property === other.property) { - this.newValue = other.newValue; - return true; - } - return false; + get canConflate(): boolean { return true; } + conflate(other: ConflatingMessage) { + if (this.property === other.property) { + this.newValue = other.newValue; + return true; } + return false; + } - void(): boolean { - return this.newValue === this.oldValue; - } + void(): boolean { + return this.newValue === this.oldValue; } +} +describe("observer2", function () { it("AllMessages", function (done) { - const ms = new Dispatch(); + const ms = new Dispatch(); const handle = ms.attach((changes: ConflatingMessage[]) => { expect(changes.length).to.equal(8); handle.release(); @@ -77,7 +77,7 @@ describe("observer2", function () { }); it("ConflatingMessage", function (done) { - const ms = new Dispatch(); + const ms = new Dispatch(); const handle = ms.attach((changes: ConflatingMessage[]) => { expect(changes.length).to.equal(4); expect(changes[0]).instanceOf(ConflatingMessage); @@ -94,7 +94,7 @@ describe("observer2", function () { }); it("SimpleMessage", function (done) { - const ms = new Dispatch(); + const ms = new Dispatch(); const handle = ms.attach((changes: ConflatingMessage[]) => { expect(changes.length).to.equal(4); expect(changes[0]).instanceOf(SimpleMessage); diff --git a/tests/test-util/src/platform.spec.ts b/packages/util/spec/platform.ts similarity index 100% rename from tests/test-util/src/platform.spec.ts rename to packages/util/spec/platform.ts diff --git a/tests/test-util/src/stack.spec.ts b/packages/util/spec/stack.ts similarity index 100% rename from tests/test-util/src/stack.spec.ts rename to packages/util/spec/stack.ts diff --git a/tests/test-util/src/stateful.spec.ts b/packages/util/spec/stateful.ts similarity index 100% rename from tests/test-util/src/stateful.spec.ts rename to packages/util/spec/stateful.ts diff --git a/tests/test-util/src/string.spec.ts b/packages/util/spec/string.ts similarity index 100% rename from tests/test-util/src/string.spec.ts rename to packages/util/spec/string.ts diff --git a/packages/util/spec/support/jasmine-browser.mjs b/packages/util/spec/support/jasmine-browser.mjs new file mode 100644 index 0000000000..37205c1a08 --- /dev/null +++ b/packages/util/spec/support/jasmine-browser.mjs @@ -0,0 +1,28 @@ +import pkg from "../../package.json" with {type: "json"}; + +export default { + srcDir: "src", + srcFiles: [ + "**/*.ts" + ], + specDir: "dist-test", + specFiles: [ + "*.browser.js" + ], + esmFilenameExtension: ".js", + importMap: { + imports: { + [pkg.name]: "dist/index.js" + } + }, + env: { + stopSpecOnExpectationFailure: false, + stopOnSpecFailure: false, + random: false + }, + listenAddress: "localhost", + hostname: "localhost", + browser: { + name: "headlessFirefox" + } +}; diff --git a/packages/util/spec/support/jasmine.json b/packages/util/spec/support/jasmine.json new file mode 100644 index 0000000000..2ac6faaf94 --- /dev/null +++ b/packages/util/spec/support/jasmine.json @@ -0,0 +1,10 @@ +{ + "spec_dir": "dist-test", + "spec_files": [ + "index.node.js" + ], + "env": { + "stopSpecOnExpectationFailure": false, + "random": false + } +} \ No newline at end of file diff --git a/tests/test-util/src/types.spec.ts b/packages/util/spec/types.ts similarity index 92% rename from tests/test-util/src/types.spec.ts rename to packages/util/spec/types.ts index f4648d1260..f54c34fe2f 100644 --- a/tests/test-util/src/types.spec.ts +++ b/packages/util/spec/types.ts @@ -1,7 +1,7 @@ import { expect } from "chai"; import { bundle } from "./dts-bundle"; import { existsSync, readFile, readFileSync } from "fs"; -import * as glob from "glob"; +import { Glob } from "glob"; const NODEJS_DEPENDENCY_EXCEPTIONS = ["node-fetch", "undici", "abort-controller", "safe-buffer", "@xmldom/xmldom", "tmp", "yargs"]; const EXTERNAL_EXCEPTIONS = ["preact/hooks"]; @@ -30,7 +30,7 @@ function calcExternals(main: string = "types/index.d.ts", out: string = "dist/in describe("Types", function () { it("tsc 2.9.x import issue", function (done) { // Check for types exported from packages that do not exist in the dependcies list. - glob("../../packages/*/types/*.d.ts", {}, function (er: any, files: any) { + const glob = new Glob("../../packages/*/types/*.d.ts", {}, function (er: any, files: any) { Promise.all(files.map((f: any) => { return new Promise((resolve, reject) => { readFile(f, "utf8", function (err: any, data: any) { @@ -48,7 +48,7 @@ describe("Types", function () { it("dependencies", function (done) { // Check for types exported from packages that do not exist in the dependcies list. - glob("../../packages/*/", {}, function (er: any, folders: any) { + const glob = new Glob("../../packages/*/", {}, function (er: any, folders: any) { Promise.all(folders.filter((folder: string) => folder.indexOf("codemirror-shim") < 0).map((folder: any) => { return new Promise((resolve, reject) => { const pkg = JSON.parse(readFileSync(`${folder}package.json`, "utf8")); @@ -56,7 +56,7 @@ describe("Types", function () { // Loose es6 files need all dependencies --- resolve(); } else { - glob(`${folder}types/**/*.d.ts`, {}, function (err: any, files: any) { + const glob = new Glob(`${folder}types/**/*.d.ts`, {}, function (err: any, files: any) { if (err) throw err; let typePath = `${folder}types/index.node.d.ts`; if (!existsSync(typePath)) { diff --git a/tests/test-util/src/url.spec.ts b/packages/util/spec/url.ts similarity index 100% rename from tests/test-util/src/url.spec.ts rename to packages/util/spec/url.ts diff --git a/tests/test-util/src/xmldom.spec.ts b/packages/util/spec/xmldom.ts similarity index 97% rename from tests/test-util/src/xmldom.spec.ts rename to packages/util/spec/xmldom.ts index 48cd560c2a..fc9211e7c7 100644 --- a/tests/test-util/src/xmldom.spec.ts +++ b/packages/util/spec/xmldom.ts @@ -9,6 +9,10 @@ class TestsParser extends SAXStackParser { _endDocument = false; _Remainder = false; + constructor() { + super(); + } + startDocument() { super.startDocument(); this._startDocument = true; diff --git a/packages/util/src/array.ts b/packages/util/src/array.ts index 6ad80561e3..c9a8ae30fd 100644 --- a/packages/util/src/array.ts +++ b/packages/util/src/array.ts @@ -26,7 +26,7 @@ export function find(o: ReadonlyArray, predicate: (value: T, index: number // c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)). // d. If testResult is true, return kValue. const kValue = o[k]; - if (predicate.call(thisArg, kValue, k, o)) { + if (predicate.call(thisArg, kValue, k)) { return kValue; } // e. Increase k by 1. @@ -36,7 +36,6 @@ export function find(o: ReadonlyArray, predicate: (value: T, index: number // 7. Return undefined. return undefined; } - export interface IDifferences2 { update: T[]; exit: T[]; diff --git a/packages/util/src/cache.ts b/packages/util/src/cache.ts index e7359f9f32..7a49d76d24 100644 --- a/packages/util/src/cache.ts +++ b/packages/util/src/cache.ts @@ -1,4 +1,4 @@ -import { hashSum } from "./hashSum"; +import { hashSum } from "./hashSum.ts"; export class Cache { private _cache: { [id: string]: C } = {}; diff --git a/packages/util/src/debounce.ts b/packages/util/src/debounce.ts index 27acb1a2d6..fa8d2a4761 100644 --- a/packages/util/src/debounce.ts +++ b/packages/util/src/debounce.ts @@ -1,4 +1,4 @@ -import { hashSum } from "./hashSum"; +import { hashSum } from "./hashSum.ts"; export function debounce>(fn: () => R, timeout?: number): () => R; export function debounce>(fn: (param1: P1) => R, timeout?: number): (param1: P1) => R; @@ -33,7 +33,7 @@ export function debounce>(fn: (...params: TParam[ } export function promiseTimeout(ms: number, promise: Promise): Promise { - let id: number; + let id: any; const timeout = new Promise((resolve, reject) => { id = setTimeout(() => { clearTimeout(id); @@ -44,9 +44,9 @@ export function promiseTimeout(ms: number, promise: Promise): Promise { return Promise.race([ promise, timeout - ]).then((response: T) => { + ]).then((response: unknown) => { clearTimeout(id); - return response; + return response as T; }).catch(e => { clearTimeout(id); throw e; diff --git a/packages/util/src/dispatch.ts b/packages/util/src/dispatch.ts index 8a9716067d..b657082044 100644 --- a/packages/util/src/dispatch.ts +++ b/packages/util/src/dispatch.ts @@ -1,5 +1,5 @@ -import type { IObserverHandle } from "./observer"; -import { root } from "./platform"; +import type { IObserverHandle } from "./observer.ts"; +import { root } from "./platform.ts"; export type RquestAnimationFrame = (callback: FrameRequestCallback) => number | undefined; export type CancelAnimationFrame = (handle: number) => void | undefined; @@ -13,7 +13,7 @@ let requestAnimationFrame: RquestAnimationFrame; // cancelAnimationFrame = root.cancelAnimationFrame; } else { let lastTime = 0; - requestAnimationFrame = function (callback: FrameRequestCallback): number { + requestAnimationFrame = function (callback: FrameRequestCallback): any { const currTime = new Date().getTime(); const timeToCall = Math.max(0, 16 - (currTime - lastTime)); const id = setTimeout(() => callback(currTime + timeToCall), timeToCall); @@ -51,13 +51,13 @@ type ObserverAdapter = { export class Dispatch { private _observerID: number = 0; - private _observers: ObserverAdapter[] = []; + private _observers: ObserverAdapter[] = []; private _messageBuffer: T[] = []; constructor() { } - private observers(): ObserverAdapter[] { + private observers(): ObserverAdapter[] { return this._observers; } diff --git a/packages/util/src/graph2.ts b/packages/util/src/graph2.ts index f5a16be2f2..ebd4581290 100644 --- a/packages/util/src/graph2.ts +++ b/packages/util/src/graph2.ts @@ -1,4 +1,4 @@ -import { compare2 } from "./array"; +import { compare2 } from "./array.ts"; type ID = string | number; diff --git a/packages/util/src/index.ts b/packages/util/src/index.ts index defa30db56..6a0f803f92 100644 --- a/packages/util/src/index.ts +++ b/packages/util/src/index.ts @@ -1,21 +1,21 @@ -export * from "./__package__"; -export * from "./array"; -export * from "./cache"; -export * from "./debounce"; -export * from "./dictionary"; -export * from "./esp"; -export * from "./graph"; -export * from "./graph2"; -export * from "./hashSum"; -export * from "./immutable"; -export * from "./logging"; -export * from "./math"; -export * from "./object"; -export * from "./observer"; -export * from "./dispatch"; -export * from "./platform"; -export * from "./saxParser"; -export * from "./stack"; -export * from "./stateful"; -export * from "./string"; -export * from "./url"; +export * from "./__package__.ts"; +export * from "./array.ts"; +export * from "./cache.ts"; +export * from "./debounce.ts"; +export * from "./dictionary.ts"; +export * from "./esp.ts"; +export * from "./graph.ts"; +export * from "./graph2.ts"; +export * from "./hashSum.ts"; +export * from "./immutable.ts"; +export * from "./logging.ts"; +export * from "./math.ts"; +export * from "./object.ts"; +export * from "./observer.ts"; +export * from "./dispatch.ts"; +export * from "./platform.ts"; +export * from "./saxParser.ts"; +export * from "./stack.ts"; +export * from "./stateful.ts"; +export * from "./string.ts"; +export * from "./url.ts"; diff --git a/packages/util/src/logging.ts b/packages/util/src/logging.ts index 98e7f85e20..91c834be25 100644 --- a/packages/util/src/logging.ts +++ b/packages/util/src/logging.ts @@ -1,6 +1,6 @@ /* eslint-disable no-console */ -import { isNode } from "./platform"; -import { Stack } from "./stack"; +import { isNode } from "./platform.ts"; +import { Stack } from "./stack.ts"; export enum Level { debug, diff --git a/packages/util/src/saxParser.ts b/packages/util/src/saxParser.ts index 070ed65ce7..4a70eda08f 100644 --- a/packages/util/src/saxParser.ts +++ b/packages/util/src/saxParser.ts @@ -1,5 +1,5 @@ -import { StringAnyMap } from "./dictionary"; -import { Stack } from "./stack"; +import { StringAnyMap } from "./dictionary.ts"; +import { Stack } from "./stack.ts"; export class XMLNode { name: string = ""; @@ -34,7 +34,7 @@ export class XMLNode { } export class SAXStackParser { - root: XMLNode; + root?: XMLNode; stack: Stack = new Stack(); constructor() { @@ -128,7 +128,7 @@ class XML2JSONParser extends SAXStackParser { } } -export function xml2json(xml: string): XMLNode { +export function xml2json(xml: string): XMLNode | undefined { const saxParser = new XML2JSONParser(); saxParser.parse(xml); return saxParser.root; diff --git a/packages/util/src/stateful.ts b/packages/util/src/stateful.ts index 922a41ba15..73bf06ca7b 100644 --- a/packages/util/src/stateful.ts +++ b/packages/util/src/stateful.ts @@ -1,5 +1,5 @@ -import { Dispatch, IObserverHandle, Message } from "./dispatch"; -import { deepEquals } from "./immutable"; +import { Dispatch, IObserverHandle, Message } from "./dispatch.ts"; +import { deepEquals } from "./immutable.ts"; class PropChangedMessage extends Message { @@ -32,8 +32,8 @@ export type StateCallback = (changes: IEvent[]) => void; export type StateEvents = "propChanged" | "changed"; export class StateObject { private _espState: Partial = {} as U; - private _dispatch = new Dispatch(); - private _monitorHandle?: number; + private _dispatch = new Dispatch(); + private _monitorHandle?: any; protected _monitorTickCount: number = 0; protected clear(newVals?: Partial) { diff --git a/packages/util/src/url.ts b/packages/util/src/url.ts index 39872c546e..3a5c63ae5b 100644 --- a/packages/util/src/url.ts +++ b/packages/util/src/url.ts @@ -1,5 +1,5 @@ export function join(...segments: string[]) { - const parts: string[] = segments.reduce((parts, segment) => { + const parts: string[] = segments.reduce((parts: string[], segment) => { // Remove leading slashes from non-first part. if (parts.length > 0) { segment = segment.replace(/^\//, ""); diff --git a/packages/util/tsconfig.json b/packages/util/tsconfig.json index 3951c33c1c..01dec5ab90 100644 --- a/packages/util/tsconfig.json +++ b/packages/util/tsconfig.json @@ -1,14 +1,22 @@ { - "extends": "../tsconfig.settings.json", "compilerOptions": { - "rootDir": "./src", - "outDir": "./lib-umd", - "declarationDir": "./types", - "noImplicitAny": true, - "strictNullChecks": true, - "noImplicitThis": true + "rootDir": "src", + "module": "NodeNext", + "target": "ESNext", + "resolveJsonModule": true, + "emitDeclarationOnly": true, + "declaration": true, + "declarationDir": "types", + "strict": true, + "skipLibCheck": true, + "allowImportingTsExtensions": true, + "lib": [ + "DOM", + "ESNext", + "ES2020" + ] }, "include": [ - "./src/**/*" + "./src/index.ts" ] } \ No newline at end of file diff --git a/packages/util/tsconfig.spec.json b/packages/util/tsconfig.spec.json new file mode 100644 index 0000000000..cfd3249890 --- /dev/null +++ b/packages/util/tsconfig.spec.json @@ -0,0 +1,16 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "rootDir": ".", + "noEmit": true, + "emitDeclarationOnly": false, + "noImplicitAny": false, + "types": [ + "jasmine" + ] + }, + "include": [ + "./spec/index.browser.ts", + "./spec/index.node.ts" + ] +} \ No newline at end of file diff --git a/tests/test-util/.vscode/launch.json b/tests/test-util/.vscode/launch.json deleted file mode 100644 index 28eb91508b..0000000000 --- a/tests/test-util/.vscode/launch.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - // Use IntelliSense to learn about possible Node.js debug attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "Mocha Tests", - "type": "node", - "request": "launch", - "cwd": "${workspaceRoot}", - "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/mocha", - "windows": { - "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/mocha.cmd" - }, - "linux": { - "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/mocha" - }, - "runtimeArgs": [ - "-u", - "tdd", - "--timeout", - "999999", - "--colors", - "--exit", - "${workspaceRoot}/lib-umd/index.node.spec.js" - ], - "internalConsoleOptions": "openOnSessionStart", - "outFiles": [ - "${workspaceRoot}/build/**/*" - ] - }, - { - "name": "Chrome Debug", - "type": "chrome", - "request": "launch", - "url": "file:///${workspaceRoot}/test.html", - "trace": true, - "webRoot": "${workspaceRoot}/", - "sourceMapPathOverrides": { - "webpack:///./*": "${workspaceRoot}/*", - "webpack:///*": "/*" - } - }, - { - "name": "Chrome Debug WS", - "type": "chrome", - "request": "launch", - "url": "http://localhost:8080/tests/test-util/test.html", - "trace": true, - "webRoot": "${workspaceRoot}/", - "sourceMapPathOverrides": { - "webpack:///./*": "${workspaceRoot}/*", - "webpack:///*": "/*" - } - } - ] -} \ No newline at end of file diff --git a/tests/test-util/.vscode/tasks.json b/tests/test-util/.vscode/tasks.json deleted file mode 100644 index 79e20d2523..0000000000 --- a/tests/test-util/.vscode/tasks.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "version": "2.0.0", - "tasks": [ - { - "label": "es6 watch", - "type": "npm", - "script": "compile-es6-watch", - "problemMatcher": [ - "$tsc-watch" - ], - "presentation": { - "group": "group-build" - } - }, - { - "label": "umd watch", - "type": "npm", - "script": "compile-umd-watch", - "problemMatcher": [ - "$tsc-watch" - ], - "presentation": { - "group": "group-build" - } - }, - { - "label": "bundle watch", - "type": "npm", - "script": "bundle-watch", - "problemMatcher": [], - "presentation": { - "group": "group-build" - } - }, - { - "label": "build", - "dependsOn": [ - "es6 watch", - "umd watch", - "bundle watch" - ], - "group": { - "kind": "build", - "isDefault": true - }, - "problemMatcher": [] - } - ] -} \ No newline at end of file diff --git a/tests/test-util/CHANGELOG.md b/tests/test-util/CHANGELOG.md deleted file mode 100644 index 9258b06480..0000000000 --- a/tests/test-util/CHANGELOG.md +++ /dev/null @@ -1,406 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.5.1](https://github.com/GordonSmith/Visualization/compare/@hpcc-js/test-util@2.5.0...@hpcc-js/test-util@2.5.1) (2019-06-20) - -**Note:** Version bump only for package @hpcc-js/test-util - - - - - -# 2.5.0 (2019-06-14) - - -### Features - -* **WsStore:** Add WsStore support to comms layer ([21d0c6d](https://github.com/GordonSmith/Visualization/commit/21d0c6d)) - - - -## 2.6.4 (2019-04-05) - - - -## 2.6.3 (2019-04-02) - - - -# 2.6.0 (2019-04-02) - - - -# 2.5.0 (2019-04-01) - - - -# 2.4.0 (2019-03-29) - - -### Bug Fixes - -* **comms:** rejectUnauthorized does nothing in NodeJS ([38f793d](https://github.com/GordonSmith/Visualization/commit/38f793d)) - - - -# 2.3.0 (2019-03-21) - - -### Bug Fixes - -* **build:** Add missing dependency for "module" releases ([616544a](https://github.com/GordonSmith/Visualization/commit/616544a)) -* **marshaller:** Race condition ([2673d29](https://github.com/GordonSmith/Visualization/commit/2673d29)), closes [#3106](https://github.com/GordonSmith/Visualization/issues/3106) -* Ensure all widgets can be re-targeted ([d1f02c2](https://github.com/GordonSmith/Visualization/commit/d1f02c2)) - - -### Features - -* **codemirror:** Add HTMLEditor and CSSEditor ([d3fc39d](https://github.com/GordonSmith/Visualization/commit/d3fc39d)) -* **codemirror:** Add XML support ([74c4ea0](https://github.com/GordonSmith/Visualization/commit/74c4ea0)) -* **maps:** Add leaflet map support ([74d36d1](https://github.com/GordonSmith/Visualization/commit/74d36d1)) -* **pie:** Better pie label positioning ([f2fa36c](https://github.com/GordonSmith/Visualization/commit/f2fa36c)), closes [#2994](https://github.com/GordonSmith/Visualization/issues/2994) [#2956](https://github.com/GordonSmith/Visualization/issues/2956) -* Added MarkdownEditor and sample ([cb1792b](https://github.com/GordonSmith/Visualization/commit/cb1792b)) - - - - - - -# [2.4.0](https://github.com/GordonSmith/Visualization/compare/@hpcc-js/test-util@2.3.11...@hpcc-js/test-util@2.4.0) (2019-05-16) - - -### Features - -* **WsStore:** Add WsStore support to comms layer ([21d0c6d](https://github.com/GordonSmith/Visualization/commit/21d0c6d)) - - - - - - -## [2.3.11](https://github.com/GordonSmith/Visualization/compare/@hpcc-js/test-util@2.3.10...@hpcc-js/test-util@2.3.11) (2019-04-27) - -**Note:** Version bump only for package @hpcc-js/test-util - - - - - - -## [2.3.10](https://github.com/GordonSmith/Visualization/compare/@hpcc-js/test-util@2.3.0...@hpcc-js/test-util@2.3.10) (2019-04-06) - - - -## [2.3.8](https://github.com/GordonSmith/Visualization/compare/@hpcc-js/test-util@2.3.0...@hpcc-js/test-util@2.3.8) (2019-04-05) - - - -## 2.6.3 (2019-04-02) - - - -# 2.6.0 (2019-04-02) - - - -# 2.5.0 (2019-04-01) - - - -# 2.4.0 (2019-03-29) - - -### Bug Fixes - -* **comms:** rejectUnauthorized does nothing in NodeJS ([38f793d](https://github.com/GordonSmith/Visualization/commit/38f793d)) - - - -# 2.3.0 (2019-03-21) - - - - - - -## [2.3.7](https://github.com/GordonSmith/Visualization/compare/@hpcc-js/test-util@2.3.0...@hpcc-js/test-util@2.3.7) (2019-04-02) - - - -# 2.6.0 (2019-04-02) - - - -# 2.5.0 (2019-04-01) - - - -# 2.4.0 (2019-03-29) - - -### Bug Fixes - -* **comms:** rejectUnauthorized does nothing in NodeJS ([38f793d](https://github.com/GordonSmith/Visualization/commit/38f793d)) - - - -# 2.3.0 (2019-03-21) - - - - - - -## [2.3.6](https://github.com/GordonSmith/Visualization/compare/@hpcc-js/test-util@2.3.0...@hpcc-js/test-util@2.3.6) (2019-04-02) - - - -# 2.6.0 (2019-04-02) - - - -# 2.5.0 (2019-04-01) - - - -# 2.4.0 (2019-03-29) - - -### Bug Fixes - -* **comms:** rejectUnauthorized does nothing in NodeJS ([38f793d](https://github.com/GordonSmith/Visualization/commit/38f793d)) - - - -# 2.3.0 (2019-03-21) - - - - - - -## [2.3.5](https://github.com/GordonSmith/Visualization/compare/@hpcc-js/test-util@2.3.0...@hpcc-js/test-util@2.3.5) (2019-04-02) - - - -# 2.4.0 (2019-03-29) - - -### Bug Fixes - -* **comms:** rejectUnauthorized does nothing in NodeJS ([38f793d](https://github.com/GordonSmith/Visualization/commit/38f793d)) - - - -# 2.3.0 (2019-03-21) - - - - - - -## [2.3.4](https://github.com/GordonSmith/Visualization/compare/@hpcc-js/test-util@2.3.0...@hpcc-js/test-util@2.3.4) (2019-04-02) - - - -# 2.5.0 (2019-04-01) - - -### Bug Fixes - -* **comms:** rejectUnauthorized does nothing in NodeJS ([38f793d](https://github.com/GordonSmith/Visualization/commit/38f793d)) - - - - - - -## [2.3.3](https://github.com/GordonSmith/Visualization/compare/@hpcc-js/test-util@2.3.0...@hpcc-js/test-util@2.3.3) (2019-04-01) - - -### Bug Fixes - -* **comms:** rejectUnauthorized does nothing in NodeJS ([38f793d](https://github.com/GordonSmith/Visualization/commit/38f793d)) - - - - - - -## [2.3.2](https://github.com/GordonSmith/Visualization/compare/@hpcc-js/test-util@2.3.0...@hpcc-js/test-util@2.3.2) (2019-03-29) - - -### Bug Fixes - -* **comms:** rejectUnauthorized does nothing in NodeJS ([38f793d](https://github.com/GordonSmith/Visualization/commit/38f793d)) - - - - - - -## [2.3.1](https://github.com/GordonSmith/Visualization/compare/@hpcc-js/test-util@2.3.0...@hpcc-js/test-util@2.3.1) (2019-03-21) - -**Note:** Version bump only for package @hpcc-js/test-util - - - - - - -# [2.3.0](https://github.com/GordonSmith/Visualization/compare/@hpcc-js/test-util@2.2.0...@hpcc-js/test-util@2.3.0) (2019-02-19) - - -### Bug Fixes - -* Ensure all widgets can be re-targeted ([d1f02c2](https://github.com/GordonSmith/Visualization/commit/d1f02c2)) - - -### Features - -* Added MarkdownEditor and sample ([cb1792b](https://github.com/GordonSmith/Visualization/commit/cb1792b)) - - - - - - -# [2.2.0](https://github.com/GordonSmith/Visualization/compare/@hpcc-js/test-util@2.1.0...@hpcc-js/test-util@2.2.0) (2019-01-29) - - -### Bug Fixes - -* **marshaller:** Race condition ([2673d29](https://github.com/GordonSmith/Visualization/commit/2673d29)), closes [#3106](https://github.com/GordonSmith/Visualization/issues/3106) - - -### Features - -* **codemirror:** Add HTMLEditor and CSSEditor ([d3fc39d](https://github.com/GordonSmith/Visualization/commit/d3fc39d)) -* **codemirror:** Add XML support ([74c4ea0](https://github.com/GordonSmith/Visualization/commit/74c4ea0)) - - - - - - -# [2.1.0](https://github.com/GordonSmith/Visualization/compare/@hpcc-js/test-util@2.0.10...@hpcc-js/test-util@2.1.0) (2019-01-08) - - -### Features - -* **maps:** Add leaflet map support ([74d36d1](https://github.com/GordonSmith/Visualization/commit/74d36d1)) -* **pie:** Better pie label positioning ([f2fa36c](https://github.com/GordonSmith/Visualization/commit/f2fa36c)), closes [#2994](https://github.com/GordonSmith/Visualization/issues/2994) [#2956](https://github.com/GordonSmith/Visualization/issues/2956) - - - - - - -## [2.0.10](https://github.com/GordonSmith/Visualization/compare/@hpcc-js/test-util@2.0.9...@hpcc-js/test-util@2.0.10) (2018-12-13) - -**Note:** Version bump only for package @hpcc-js/test-util - - - - - - -## [2.0.9](https://github.com/GordonSmith/Visualization/compare/@hpcc-js/test-util@2.0.8...@hpcc-js/test-util@2.0.9) (2018-12-04) - -**Note:** Version bump only for package @hpcc-js/test-util - - - - - - -## [2.0.8](https://github.com/GordonSmith/Visualization/compare/@hpcc-js/test-util@2.0.7...@hpcc-js/test-util@2.0.8) (2018-11-27) - -**Note:** Version bump only for package @hpcc-js/test-util - - - - - - - -## [2.0.7](https://github.com/GordonSmith/Visualization/compare/@hpcc-js/test-util@2.0.6...@hpcc-js/test-util@2.0.7) (2018-11-26) - - -### Bug Fixes - -* **build:** Add missing dependency for "module" releases ([616544a](https://github.com/GordonSmith/Visualization/commit/616544a)) - - - - - - -## [2.0.6](https://github.com/GordonSmith/Visualization/compare/@hpcc-js/test-util@2.0.5...@hpcc-js/test-util@2.0.6) (2018-10-30) - -**Note:** Version bump only for package @hpcc-js/test-util - - - - - - -## [2.0.5](https://github.com/GordonSmith/Visualization/compare/@hpcc-js/test-util@2.0.4...@hpcc-js/test-util@2.0.5) (2018-10-15) - -**Note:** Version bump only for package @hpcc-js/test-util - - - - - - -## [2.0.4](https://github.com/GordonSmith/Visualization/compare/@hpcc-js/test-util@2.0.3...@hpcc-js/test-util@2.0.4) (2018-10-05) - -**Note:** Version bump only for package @hpcc-js/test-util - - - - - - -## [2.0.3](https://github.com/GordonSmith/Visualization/compare/@hpcc-js/test-util@2.0.2...@hpcc-js/test-util@2.0.3) (2018-09-24) - -**Note:** Version bump only for package @hpcc-js/test-util - - - - - - -## [2.0.2](https://github.com/GordonSmith/Visualization/compare/@hpcc-js/test-util@2.0.1...@hpcc-js/test-util@2.0.2) (2018-09-10) - -**Note:** Version bump only for package @hpcc-js/test-util - - - - - - -## [2.0.1](https://github.com/GordonSmith/Visualization/compare/@hpcc-js/test-util@2.0.0...@hpcc-js/test-util@2.0.1) (2018-09-01) - -**Note:** Version bump only for package @hpcc-js/test-util - - - - - - -# [2.0.0](https://github.com/GordonSmith/Visualization/compare/@hpcc-js/test-util@0.0.55...@hpcc-js/test-util@2.0.0) (2018-08-24) - -**Note:** Version bump only for package @hpcc-js/test-util - - - - - - -# [2.0.0-rc.0](https://github.com/GordonSmith/Visualization/compare/@hpcc-js/test-util@0.0.55...@hpcc-js/test-util@2.0.0-rc.0) (2018-08-24) - -**Note:** Version bump only for package @hpcc-js/test-util diff --git a/tests/test-util/karma.conf.js b/tests/test-util/karma.conf.js deleted file mode 100644 index e1289141ea..0000000000 --- a/tests/test-util/karma.conf.js +++ /dev/null @@ -1,14 +0,0 @@ -module.exports = function (config) { - config.set({ - basePath: '.', - frameworks: ['mocha'], - reporters: ['mocha'], - files: ['build/bundle.test.js'], - port: 9876, - colors: true, - singleRun: true, - browserNoActivityTimeout: 30000, - failOnEmptyTestSuite: false, - logLevel: config.LOG_INFO - }); -}; diff --git a/tests/test-util/package.json b/tests/test-util/package.json deleted file mode 100644 index fca1ca3418..0000000000 --- a/tests/test-util/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "private": true, - "name": "@hpcc-js/test-util", - "type": "module", - "dependencies": { - "@hpcc-js/util": "^2.51.0", - "es6-promise": "4.2.8" - }, - "devDependencies": { - "@types/mkdirp": "1.0.2", - "@types/glob": "5.0.38", - "@types/mocha": "10.0.7", - "detect-indent": "7.0.1" - }, - "scripts": { - "clean": "rimraf --glob lib* types dist tmp *.tsbuildinfo", - "compile-es6": "tsc --module es6 --outDir ./lib-es6", - "compile-es6-watch": "npm run compile-es6 -- -w", - "bundle": "webpack", - "bundle-watch": "npm run bundle -- --watch", - "watch": "npm-run-all compile-es6 -p compile-es6-watch bundle-watch", - "build": "npm run compile-es6 && npm run bundle", - "test": "npm run test:node && npm run test:chrome", - "test:node": "mocha dist/bundle.test.js --reporter spec", - "test:chrome": "mocha-headless-chrome -f ./test.html", - "update": "npx --yes npm-check-updates -u -t minor" - } -} \ No newline at end of file diff --git a/tests/test-util/src/index.node.spec.ts b/tests/test-util/src/index.node.spec.ts deleted file mode 100644 index 2dca907907..0000000000 --- a/tests/test-util/src/index.node.spec.ts +++ /dev/null @@ -1,3 +0,0 @@ -import "./types.spec"; - -import "./index.spec"; diff --git a/tests/test-util/src/index.spec.ts b/tests/test-util/src/index.spec.ts deleted file mode 100644 index 177b314ba8..0000000000 --- a/tests/test-util/src/index.spec.ts +++ /dev/null @@ -1,16 +0,0 @@ -import "./array.spec.js"; -import "./cache.spec.js"; -import "./debounce.spec.js"; -import "./dictionary.spec.js"; -import "./esp.spec.js"; -import "./graph.spec.js"; -import "./graph2.spec.js"; -import "./logging.spec.js"; -import "./object.spec.js"; -import "./observer.spec.js"; -import "./platform.spec.js"; -import "./stack.spec.js"; -import "./stateful.spec.js"; -import "./string.spec.js"; -import "./url.spec.js"; -import "./xmldom.spec.js"; diff --git a/tests/test-util/test.html b/tests/test-util/test.html deleted file mode 100644 index c219425e6c..0000000000 --- a/tests/test-util/test.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - HPCC Systems - Test - - - - - - - - -
- - - - - \ No newline at end of file diff --git a/tests/test-util/tsconfig.json b/tests/test-util/tsconfig.json deleted file mode 100644 index 9abe64e617..0000000000 --- a/tests/test-util/tsconfig.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "compilerOptions": { - "target": "es5", - "module": "commonjs", - "outDir": "./lib-umd", - "sourceMap": true, - "declaration": false, - "moduleResolution": "node", - "noImplicitAny": true, - "noEmitOnError": false, - "noUnusedLocals": true, - "strictNullChecks": true, - "lib": [ - "dom", - "es5", - "es2015.promise", - "es2015.iterable" - ], - "types": [ - "chai", - "mocha" - ] - }, - "include": [ - "src/*" - ] -} \ No newline at end of file diff --git a/tests/test-util/webpack.config.cjs b/tests/test-util/webpack.config.cjs deleted file mode 100644 index feca38b51b..0000000000 --- a/tests/test-util/webpack.config.cjs +++ /dev/null @@ -1,10 +0,0 @@ -var path = require('path'); - -module.exports = { - entry: './lib-es6/index.spec.js', - mode: "development", - output: { - path: path.join(__dirname, "dist"), - filename: 'bundle.test.js' - } -} diff --git a/utils/data/package.json b/utils/data/package.json index b371167b6e..b8af265767 100644 --- a/utils/data/package.json +++ b/utils/data/package.json @@ -4,7 +4,7 @@ "description": "", "main": "index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", + "test-old": "echo \"Error: no test specified\" && exit 1", "update": "npx --yes npm-check-updates -u -t minor" }, "author": "", diff --git a/website/package.json b/website/package.json index c9d3b88187..92669e16c5 100644 --- a/website/package.json +++ b/website/package.json @@ -17,7 +17,7 @@ "build": "run-s compile-umd generate", "build-publish": "run-s compile-umd generate-publish", "watch": "run-p compile-util-watch compile-web-watch", - "test": "echo \"Error: no test specified\" && exit 1" + "test-old": "echo \"Error: no test specified\" && exit 1" }, "author": "", "license": "ISC",