From 18b8f5979db8e736b7afacf798976b08a3f1482a Mon Sep 17 00:00:00 2001 From: Andrew Stein Date: Wed, 12 Apr 2023 11:11:24 -0400 Subject: [PATCH 1/6] Build separate web/node emscripten targets --- cpp/perspective/CMakeLists.txt | 14 +++++--- cpp/perspective/build.js | 11 ++++-- .../src/include/perspective/base.h | 9 ++++- packages/perspective-esbuild-plugin/worker.js | 3 +- packages/perspective/build.js | 3 +- packages/perspective/src/js/api/client.js | 13 +------ .../perspective/src/js/perspective.browser.js | 2 +- packages/perspective/src/js/perspective.js | 21 +---------- .../perspective/src/js/perspective.node.js | 5 ++- .../perspective/src/js/perspective.worker.js | 2 +- tools/perspective-bench/src/js/bench.js | 35 +++++++++++++------ 11 files changed, 60 insertions(+), 58 deletions(-) diff --git a/cpp/perspective/CMakeLists.txt b/cpp/perspective/CMakeLists.txt index aafd8e6498..12e2775907 100644 --- a/cpp/perspective/CMakeLists.txt +++ b/cpp/perspective/CMakeLists.txt @@ -265,7 +265,7 @@ elseif(PSP_CPP_BUILD OR PSP_PYTHON_BUILD) else() set(OPT_FLAGS " \ -O3 \ - -g0 \ + -g1 \ ") endif() endif() @@ -514,14 +514,12 @@ if(PSP_WASM_BUILD) --source-map-base \"\" \ --memory-init-file 0 \ --no-entry \ - -s EXPORT_ES6=1 \ -s NO_EXIT_RUNTIME=1 \ -s NO_FILESYSTEM=1 \ -s ALLOW_MEMORY_GROWTH=1 \ -s MODULARIZE=1 \ -s EXPORT_NAME=\"load_perspective\" \ -s MAXIMUM_MEMORY=4gb \ - -s USE_ES6_IMPORT_META=0 \ -s ERROR_ON_UNDEFINED_SYMBOLS=1 \ ") @@ -534,8 +532,16 @@ if(PSP_WASM_BUILD) add_executable(perspective_cjs src/cpp/emscripten.cpp) target_link_libraries(perspective_cjs psp) target_compile_definitions(perspective_cjs PRIVATE PSP_ENABLE_WASM=1) - set_target_properties(perspective_cjs PROPERTIES RUNTIME_OUTPUT_DIRECTORY "./esm/") + target_link_options(perspective_cjs PUBLIC -sENVIRONMENT="node" -sUSE_ES6_IMPORT_META=0 -sEXPORT_ES6=0) + set_target_properties(perspective_cjs PROPERTIES RUNTIME_OUTPUT_DIRECTORY "./node/") set_target_properties(perspective_cjs PROPERTIES OUTPUT_NAME "perspective.cpp") + + add_executable(perspective_esm src/cpp/emscripten.cpp) + target_link_libraries(perspective_esm psp) + target_compile_definitions(perspective_esm PRIVATE PSP_ENABLE_WASM=1) + target_link_options(perspective_esm PUBLIC -sENVIRONMENT="web" -sUSE_ES6_IMPORT_META=1 -sEXPORT_ES6=1) + set_target_properties(perspective_esm PROPERTIES RUNTIME_OUTPUT_DIRECTORY "./web/") + set_target_properties(perspective_esm PROPERTIES OUTPUT_NAME "perspective.cpp") elseif(PSP_CPP_BUILD OR PSP_PYTHON_BUILD) if(NOT WIN32) set(CMAKE_SHARED_LIBRARY_SUFFIX .so) diff --git a/cpp/perspective/build.js b/cpp/perspective/build.js index ad0ecc907c..6e0c2d9ac9 100644 --- a/cpp/perspective/build.js +++ b/cpp/perspective/build.js @@ -21,11 +21,16 @@ try { cwd, stdio, }); - execSync(`cpy esm/**/* ../esm`, { cwd, stdio }); + execSync(`cpy web/**/* ../web`, { cwd, stdio }); + execSync(`cpy node/**/* ../node`, { cwd, stdio }); - const wasm = fs.readFileSync("dist/esm/perspective.cpp.wasm"); + const wasm = fs.readFileSync("dist/web/perspective.cpp.wasm"); const compressed = fflate.compressSync(wasm); - fs.writeFileSync("dist/esm/perspective.cpp.wasm", compressed); + fs.writeFileSync("dist/web/perspective.cpp.wasm", compressed); + + const wasm2 = fs.readFileSync("dist/node/perspective.cpp.wasm"); + const compressed2 = fflate.compressSync(wasm2); + fs.writeFileSync("dist/node/perspective.cpp.wasm", compressed2); } catch (e) { console.error(e); process.exit(1); diff --git a/cpp/perspective/src/include/perspective/base.h b/cpp/perspective/src/include/perspective/base.h index dab4a33a64..79ddb733db 100644 --- a/cpp/perspective/src/include/perspective/base.h +++ b/cpp/perspective/src/include/perspective/base.h @@ -431,8 +431,15 @@ struct PERSPECTIVE_EXPORT t_cmp_charptr { } }; +template +struct binary_function { + using first_argument_type = Arg1; + using second_argument_type = Arg2; + using result_type = Result; +}; + struct t_cchar_umap_cmp - : public std::binary_function { + : public binary_function { inline bool operator()(const char* x, const char* y) const { return strcmp(x, y) == 0; diff --git a/packages/perspective-esbuild-plugin/worker.js b/packages/perspective-esbuild-plugin/worker.js index 08d25e7432..fa916692ef 100644 --- a/packages/perspective-esbuild-plugin/worker.js +++ b/packages/perspective-esbuild-plugin/worker.js @@ -22,13 +22,12 @@ exports.WorkerPlugin = function WorkerPlugin(options = {}) { define: { global: "self", }, - plugins: [EmptyPlugin(["fs", "path"])], entryNames: "[name]", chunkNames: "[name]", assetNames: "[name]", minify: !process.env.PSP_DEBUG, bundle: true, - sourcemap: false, + sourcemap: true, }); return { diff --git a/packages/perspective/build.js b/packages/perspective/build.js index 59440b434a..0b4455fc00 100644 --- a/packages/perspective/build.js +++ b/packages/perspective/build.js @@ -58,7 +58,8 @@ const BUILD = [ async function build_all() { const { default: cpy } = await cpy_mod; - await cpy(["../../cpp/perspective/dist/esm/*"], "dist/pkg/esm"); + await cpy(["../../cpp/perspective/dist/web/*"], "dist/pkg/web"); + await cpy(["../../cpp/perspective/dist/node/*"], "dist/pkg/node"); await Promise.all(BUILD.map(build)).catch(() => process.exit(1)); } diff --git a/packages/perspective/src/js/api/client.js b/packages/perspective/src/js/api/client.js index d4a459bf54..b16254651b 100644 --- a/packages/perspective/src/js/api/client.js +++ b/packages/perspective/src/js/api/client.js @@ -120,18 +120,7 @@ export class Client { */ _handle(e) { if (!this._worker.initialized.value) { - if ( - !this._initialized && - typeof document !== "undefined" && - document && - typeof window !== undefined && - window - ) { - try { - const event = document.createEvent("Event"); - event.initEvent("perspective-ready", false, true); - window.dispatchEvent(event); - } catch (e) {} + if (!this._initialized) { this._initialized = true; } diff --git a/packages/perspective/src/js/perspective.browser.js b/packages/perspective/src/js/perspective.browser.js index 7cd7330c07..3ff5bb4169 100644 --- a/packages/perspective/src/js/perspective.browser.js +++ b/packages/perspective/src/js/perspective.browser.js @@ -16,7 +16,7 @@ import { override_config } from "./config/index.js"; import { Decompress } from "fflate"; import wasm_worker from "../../src/js/perspective.worker.js"; -import wasm from "../../dist/pkg/esm/perspective.cpp.wasm"; +import wasm from "../../dist/pkg/web/perspective.cpp.wasm"; let IS_INLINE = false; diff --git a/packages/perspective/src/js/perspective.js b/packages/perspective/src/js/perspective.js index 9f46651f1a..45580cdb0d 100644 --- a/packages/perspective/src/js/perspective.js +++ b/packages/perspective/src/js/perspective.js @@ -2297,10 +2297,10 @@ export default function (Module) { __MODULE__({ wasmBinary: msg.buffer, wasmJSMethod: "native-wasm", + locateFile: (x) => x, }).then((mod) => { __MODULE__ = mod; __MODULE__.init(); - notify_main_thread(); super.init(msg); }); } @@ -2317,22 +2317,3 @@ export default function (Module) { return perspective; } - -function notify_main_thread() { - if (typeof self !== "undefined") { - try { - if ( - self.dispatchEvent && - !self._perspective_initialized && - self.document !== null - ) { - self._perspective_initialized = true; - const event = self.document.createEvent("Event"); - event.initEvent("perspective-ready", false, true); - self.dispatchEvent(event); - } else if (!self.document && self.postMessage) { - self.postMessage({}); - } - } catch (e) {} - } -} diff --git a/packages/perspective/src/js/perspective.node.js b/packages/perspective/src/js/perspective.node.js index 4870e1d4d5..09572741bf 100644 --- a/packages/perspective/src/js/perspective.node.js +++ b/packages/perspective/src/js/perspective.node.js @@ -23,11 +23,10 @@ const process = require("process"); const path = require("path"); const { Decompress } = require("fflate"); -const load_perspective = - require("../../dist/pkg/esm/perspective.cpp.js").default; +const load_perspective = require("../../dist/pkg/node/perspective.cpp.js"); const LOCAL_PATH = path.join(process.cwd(), "node_modules"); -const buffer = require("../../dist/pkg/esm/perspective.cpp.wasm").default; +const buffer = require("../../dist/pkg/node/perspective.cpp.wasm").default; function deflate(buffer) { let parts = []; diff --git a/packages/perspective/src/js/perspective.worker.js b/packages/perspective/src/js/perspective.worker.js index 08edab2bd3..4352a971f2 100644 --- a/packages/perspective/src/js/perspective.worker.js +++ b/packages/perspective/src/js/perspective.worker.js @@ -7,7 +7,7 @@ * */ -import load_perspective from "../../dist/pkg/esm/perspective.cpp.js"; +import load_perspective from "../../dist/pkg/web/perspective.cpp.js"; import perspective from "./perspective.js"; export default globalThis.perspective = perspective(load_perspective); diff --git a/tools/perspective-bench/src/js/bench.js b/tools/perspective-bench/src/js/bench.js index a13b0ca95e..d809c341a0 100644 --- a/tools/perspective-bench/src/js/bench.js +++ b/tools/perspective-bench/src/js/bench.js @@ -14,7 +14,7 @@ const VERSIONS = ["@finos/perspective", ...PKG_DEPS]; function load_version(path, i) { const module = require(path); - let {version} = JSON.parse( + let { version } = JSON.parse( fs.readFileSync(require.resolve(`${path}/package.json`)) ); @@ -22,7 +22,7 @@ function load_version(path, i) { version = `${version} (master)`; } - return {version, perspective: module.default || module}; + return { version, perspective: module.default || module }; } const MODULES = VERSIONS.map(load_version); @@ -48,11 +48,11 @@ Object.defineProperty(Array.prototype, "sum", { }, }); -async function benchmark({name, before, before_all, test, after, after_all}) { +async function benchmark({ name, before, before_all, test, after, after_all }) { let obs_records = []; console.log(`${name}`); for (let j = 0; j < MODULES.length; j++) { - const {version, perspective} = MODULES[j]; + const { version, perspective } = MODULES[j]; const args = []; args.push_if(await before_all?.(perspective)); const observations = []; @@ -106,10 +106,10 @@ async function to_data_suite() { async function before_all(perspective) { const table = await perspective.table(SUPERSTORE_ARROW.slice()); const view = await table.view(); - return {table, view}; + return { table, view }; } - async function after_all(perspective, {table, view}) { + async function after_all(perspective, { table, view }) { await view.delete(); await table.delete(); } @@ -118,7 +118,7 @@ async function to_data_suite() { name: `.to_arrow()`, before_all, after_all, - async test(_perspective, {view}) { + async test(_perspective, { view }) { const _arrow = await view.to_arrow(); }, }); @@ -127,7 +127,7 @@ async function to_data_suite() { name: `.to_csv()`, before_all, after_all, - async test(_perspective, {view}) { + async test(_perspective, { view }) { const _csv = await view.to_csv(); }, }); @@ -136,7 +136,7 @@ async function to_data_suite() { name: `.to_columns()`, before_all, after_all, - async test(_perspective, {view}) { + async test(_perspective, { view }) { const _columns = await view.to_columns(); }, }); @@ -145,7 +145,7 @@ async function to_data_suite() { name: `.to_json()`, before_all, after_all, - async test(_perspective, {view}) { + async test(_perspective, { view }) { const _json = await view.to_json(); }, }); @@ -178,6 +178,21 @@ async function view_suite() { return await table.view(); }, }); + + await benchmark({ + name: `.view({group_by})`, + before_all, + after_all, + after, + async test(perspective, table) { + const [M, m, _] = perspective.version; + if ((M === 1 && m >= 2) || M === 2) { + return await table.view({ group_by: ["Product Name"] }); + } else { + return await table.view({ row_pivots: ["Product Name"] }); + } + }, + }); } async function table_suite() { From cf1556994d34849434b78318c6b2f37411adc336 Mon Sep 17 00:00:00 2001 From: Andrew Stein Date: Thu, 27 Apr 2023 00:43:07 -0400 Subject: [PATCH 2/6] Add `perspective-cli` to tests and other test fixes --- packages/perspective-cli/package.json | 4 +- packages/perspective-cli/src/js/index.js | 2 +- .../test/js/superstore.spec.js | 18 +-- packages/perspective-jupyterlab/package.json | 7 +- .../test/js/resize.spec.js | 2 +- packages/perspective-viewer-d3fc/package.json | 6 +- .../test/results/results.json | 153 ------------------ .../test/results/results.json | 33 ---- .../test/results/results.json | 16 -- packages/perspective-workspace/package.json | 9 -- .../test/config/test_node.config.js | 17 -- rust/perspective-viewer/package.json | 8 +- scripts/clean.js | 57 ++----- scripts/test_js.js | 8 - tools/perspective-test/playwright.config.ts | 4 + .../perspective-test/src/js/global_startup.ts | 8 +- .../src/js/global_teardown.ts | 6 +- 17 files changed, 45 insertions(+), 313 deletions(-) delete mode 100644 packages/perspective-viewer-d3fc/test/results/results.json delete mode 100644 packages/perspective-viewer-datagrid/test/results/results.json delete mode 100644 packages/perspective-viewer-openlayers/test/results/results.json delete mode 100644 packages/perspective/test/config/test_node.config.js diff --git a/packages/perspective-cli/package.json b/packages/perspective-cli/package.json index 569753676d..8c5fac4f84 100644 --- a/packages/perspective-cli/package.json +++ b/packages/perspective-cli/package.json @@ -12,9 +12,7 @@ ], "typings": "index.d.ts", "scripts": { - "clean": "rimraf build", - "test:run": "jest --rootDir=. --config=../../tools/perspective-test/jest.config.js --color", - "test": "npm-run-all test:build test:run" + "clean": "rimraf build" }, "repository": { "type": "git", diff --git a/packages/perspective-cli/src/js/index.js b/packages/perspective-cli/src/js/index.js index a73cd12f92..a169f4d627 100755 --- a/packages/perspective-cli/src/js/index.js +++ b/packages/perspective-cli/src/js/index.js @@ -161,7 +161,7 @@ program .option("-o, --open", "Open a browser automagically.") .action(host); -if (require.main) { +if (require.main === module) { if (!process.argv.slice(2).length) { program.help(); } else { diff --git a/packages/perspective-cli/test/js/superstore.spec.js b/packages/perspective-cli/test/js/superstore.spec.js index 661fcbcb81..8722e9febe 100644 --- a/packages/perspective-cli/test/js/superstore.spec.js +++ b/packages/perspective-cli/test/js/superstore.spec.js @@ -7,18 +7,19 @@ * */ -const puppeteer = require("puppeteer"); - +const { test, expect } = require("@playwright/test"); +const path = require("path"); const { host } = require("../../src/js/index.js"); -describe("CLI", function () { - it("Tests something", async () => { +test.describe("CLI", function () { + test("Tests something", async ({ page }) => { const options = { port: 0 }; - const server = await host("test/csv/test.csv", options); + const server = await host( + path.join(__dirname, "../csv/test.csv"), + options + ); const port = server._server.address().port; - const browser = await puppeteer.launch({ headless: true }); - const page = await browser.newPage(); await page.goto(`http://localhost:${port}/`); await page.waitForSelector( "perspective-viewer perspective-viewer-datagrid" @@ -35,10 +36,7 @@ describe("CLI", function () { { x: 3, y: 4 }, { x: 5, y: 6 }, ]); - await page.close(); - await browser.close(); - await new Promise((x) => setTimeout(x)); server.close(); }); }); diff --git a/packages/perspective-jupyterlab/package.json b/packages/perspective-jupyterlab/package.json index cc7ef205fe..f32fdf5f64 100644 --- a/packages/perspective-jupyterlab/package.json +++ b/packages/perspective-jupyterlab/package.json @@ -25,13 +25,10 @@ "clean": "npm-run-all clean:*", "clean:dist": "rimraf dist", "clean:lib": "rimraf lib", - "clean:screenshots": "rimraf \"screenshots/**/*.@(failed|diff).png\"", "clean:labextension": "rimraf ../../python/perspective/perspective/labextension", "clean:nbextension": "rimraf ../../python/perspective/perspective/nbextension/static", - "test:build": "cpy \"test/html/*\" dist/umd && cpy \"test/csv/*\" dist/umd && cpy \"test/css/*\" dist/umd && node build.js --test", - "test:jupyter:build": "cpy \"test/html/*\" dist/umd && cpy \"test/arrow/*\" dist/umd && cpy \"test/css/*\" dist/umd", - "test:jupyter:run": "__JUPYTERLAB_PORT__=6538 npx playwright test --config ../../tools/perspective-test/playwright.config.js -- --jupyter", - "test:jupyter": "npm-run-all test:jupyter:build test:jupyter:run", + "test:build": "node build.js --test", + "test:jupyter": "__JUPYTERLAB_PORT__=6538 npx playwright test --config ../../tools/perspective-test/playwright.config.js -- --jupyter", "test": "npm-run-all test:build", "version": "yarn build" }, diff --git a/packages/perspective-jupyterlab/test/js/resize.spec.js b/packages/perspective-jupyterlab/test/js/resize.spec.js index 289a6caf59..8768ae57c4 100644 --- a/packages/perspective-jupyterlab/test/js/resize.spec.js +++ b/packages/perspective-jupyterlab/test/js/resize.spec.js @@ -11,7 +11,7 @@ const { test } = require("@playwright/test"); import { compareContentsToSnapshot } from "@finos/perspective-test"; test.beforeEach(async ({ page }) => { - await page.goto("/@finos/perspective-jupyterlab/dist/umd/resize.html", { + await page.goto("/@finos/perspective-jupyterlab/test/html/resize.html", { waitUntil: "networkidle", }); }); diff --git a/packages/perspective-viewer-d3fc/package.json b/packages/perspective-viewer-d3fc/package.json index ecd577d583..6f633a4d4c 100644 --- a/packages/perspective-viewer-d3fc/package.json +++ b/packages/perspective-viewer-d3fc/package.json @@ -31,13 +31,9 @@ "src/**/*" ], "scripts": { - "bench": "npm-run-all bench:build bench:run", - "bench:build": "echo \"No Benchmarks\"", - "bench:run": "echo \"No Benchmarks\"", "prebuild": "mkdirp dist/esm", "build": "node ./build.js", - "clean": "rimraf dist", - "clean:screenshots": "rimraf \"test/screenshots/**/*.@(failed|diff).png\"" + "clean": "rimraf dist" }, "publishConfig": { "access": "public" diff --git a/packages/perspective-viewer-d3fc/test/results/results.json b/packages/perspective-viewer-d3fc/test/results/results.json deleted file mode 100644 index 14ac36ce4f..0000000000 --- a/packages/perspective-viewer-d3fc/test/results/results.json +++ /dev/null @@ -1,153 +0,0 @@ -{ - "events_perspective-config-update_event_is_fired_when_series_axis_is_changed": "6ac5967822232cd80853f4f11eb614f1", - "events_perspective-config-update_event_is_fired_when_legend_position_is_changed": "01c7817ea82ab76f2a4d9ba47f5dce7a", - "__GIT_COMMIT__": "43dd81da00f8f42eb33d71f3e4aa6a436fdf8f8a", - "xyline_shows_a_grid_without_any_settings_applied": "2aba74b5e5db14953a041e7ebb544a8a", - "xyline_displays_visible_columns_": "c8bf1c32455f8f8a5210e6ba368ba3db", - "xyline_pivot_by_a_row": "6bb755705694cc8d7766c988fc98b8b4", - "xyline_pivot_by_two_rows": "041b90795559f10cf36cf422d176858b", - "xyline_pivot_by_a_column": "157552397fee29119f7c57bc9c21b1bd", - "xyline_pivot_by_a_row_and_a_column": "1a0f5c669cc13e2f8e1cc5608cfa2880", - "xyline_pivot_by_two_rows_and_two_columns": "e320fd64ebc1a7da6e3afaf851edd4d7", - "xyline_sort_by_a_hidden_column": "dfbcb025c3ad2d39fdf6aa9bbe45a4a8", - "xyline_sort_by_a_numeric_column": "52e986e8c8bd802b4cd2b68d01cb46df", - "xyline_sort_by_an_alpha_column": "32e5ba05670e56cd1f24e34ae01af616", - "xyline_filters_filters_by_a_numeric_column": "2e67b1fdc2757ff51ea29b329b3863fd", - "xyline_filters_filters_by_an_alpha_column": "2aa0a0f37f6012559d60d5ede867e9f8", - "xyline_filters_filters_with__in__comparator": "02493920fecd463be88fd0b41078b1c0", - "line_shows_a_grid_without_any_settings_applied": "00461cb17d37c02f6372a42e8428a32f", - "line_displays_visible_columns_": "fa1446bbfc06f10c20b40b72fab007af", - "line_pivot_by_a_row": "6b174490e7c742e95392491fe758fafb", - "line_pivot_by_two_rows": "3447c25d3e8cfa126ab30a3fdab80e41", - "line_pivot_by_a_column": "085e11e649facebf58b056e966e4f136", - "line_pivot_by_a_row_and_a_column": "fa16203ee30356b4b8c1eb89b0402399", - "line_pivot_by_two_rows_and_two_columns": "cb881bfae3d2f48c7cfe73e49ff50bb4", - "line_sort_by_a_hidden_column": "2cfbc684cc59c45769f763b6a24f3e57", - "line_sort_by_a_numeric_column": "9aea6586b5e8af424aa3b15a8a5639b2", - "line_sort_by_an_alpha_column": "846bc7cfd872af401ab607157d0700ba", - "line_filters_filters_by_a_numeric_column": "846bc7cfd872af401ab607157d0700ba", - "line_filters_filters_by_an_alpha_column": "435be9452692645da638476de27630ed", - "line_filters_filters_with__in__comparator": "91aa5dbce121d81e298138d1a6b89537", - "treemap_shows_a_grid_without_any_settings_applied": "63657741992da912059ea60adf5c65e6", - "treemap_displays_visible_columns_": "b8f252a4c796f376cf179595b1c956e6", - "treemap_pivot_by_a_row": "54c143862c314e661016a0ab715382a9", - "treemap_pivot_by_two_rows": "1aa82c9da548a632dce40a81b2ce84dd", - "treemap_pivot_by_a_column": "a6a32486ea60d80461848b0d87c820f8", - "treemap_pivot_by_a_row_and_a_column": "9b79c6ff339938fd8ac1e353b9599ce5", - "treemap_pivot_by_two_rows_and_two_columns": "f4f058946246bab3216b35f200fc5d1b", - "treemap_sort_by_a_hidden_column": "d52f971fc3b9d6d7e86998ec4e336830", - "treemap_sort_by_a_numeric_column": "d96768a068a7be1a2b57e23d9f3074e2", - "treemap_sort_by_an_alpha_column": "2df311645b2db99abfaca950798c9391", - "treemap_filters_filters_by_a_numeric_column": "1bb6ff7361c4930db6993d2e2d04b47d", - "treemap_filters_filters_by_an_alpha_column": "ecbb4e329860e7d7a4a6ae79fd5d0e12", - "treemap_filters_filters_with__in__comparator": "ecfdc83e6e9a160e72fc83773b54851d", - "heatmap_shows_a_grid_without_any_settings_applied": "0ed0f1af1cca3c8a81fdc6e3d99e2056", - "heatmap_displays_visible_columns_": "2a28a3024117f83c8ea753e77b156c9f", - "heatmap_pivot_by_a_row": "eb79410b4d1689223530c88be07e5e2b", - "heatmap_pivot_by_two_rows": "e848a8002978c451ba54a6e5243ceb71", - "heatmap_pivot_by_a_column": "c48c7033965ede4561c560355fa489f2", - "heatmap_pivot_by_a_row_and_a_column": "39ce7dd0c00810502e701a2586b7a27b", - "heatmap_pivot_by_two_rows_and_two_columns": "9801ea534d800b6162d54f5c869f1871", - "heatmap_sort_by_a_hidden_column": "9091b086506182d010d6aec69223a915", - "heatmap_sort_by_a_numeric_column": "0ed0f1af1cca3c8a81fdc6e3d99e2056", - "heatmap_sort_by_an_alpha_column": "0ed0f1af1cca3c8a81fdc6e3d99e2056", - "heatmap_filters_filters_by_a_numeric_column": "0ed0f1af1cca3c8a81fdc6e3d99e2056", - "heatmap_filters_filters_by_an_alpha_column": "a6892cd9cde7bc67ff14503b7bc6c430", - "heatmap_filters_filters_with__in__comparator": "925e16ed383b5107617c223f1697d0ea", - "scatter_shows_a_grid_without_any_settings_applied": "4ff7324747f2dd29917bac83ff2a79d7", - "scatter_displays_visible_columns_": "06245c826c8d69f6f22d202c8b539628", - "scatter_pivot_by_a_row": "7c43fe38e106c25db6fae2e669f672ff", - "scatter_pivot_by_two_rows": "c61c15accff9b6c0397e908c6691befa", - "scatter_pivot_by_a_column": "f1978645c2299ef772ca496f8686a3d2", - "scatter_pivot_by_a_row_and_a_column": "3c79935778ebb2b8c83355b95f0ac3e5", - "scatter_pivot_by_two_rows_and_two_columns": "7edb1cf1f721c98e9e76472a6f88f979", - "scatter_sort_by_a_hidden_column": "afddf86fe6cd9518e9b07d10b70c8898", - "scatter_sort_by_a_numeric_column": "b903456785023a917ad5eea7f5545e3c", - "scatter_sort_by_an_alpha_column": "b8325659e36514b686c1c0364ff161e7", - "scatter_filters_filters_by_a_numeric_column": "25da8e656d1093e704c2b0a86b7c1099", - "scatter_filters_filters_by_an_alpha_column": "9c875acf5659bc1a5d5cc28def9a7fa7", - "scatter_filters_filters_with__in__comparator": "c5f5242d7d8eecebc12ef77506a905a6", - "scatter_Scatter_charts_with_a__label__field_render_the_label": "313ffe98bbf4d005b54489937ed7f7ba", - "scatter_Scatter_charts_with_a__label__field_render_the_label_when_a_group_by_operation_is_applied": "313ffe98bbf4d005b54489937ed7f7ba", - "yscatter_shows_a_grid_without_any_settings_applied": "6a2bf6ec84ab5ca863009711a6ebefcd", - "yscatter_displays_visible_columns_": "800907dd3993265947c513517cae7dc4", - "yscatter_pivot_by_a_row": "2660b8541bee0b12145e227250afed0e", - "yscatter_pivot_by_two_rows": "2f97043e69c432eb156d29dc214000d4", - "yscatter_pivot_by_a_column": "995b9a4c547d51aa677e2a3e283dd036", - "yscatter_pivot_by_a_row_and_a_column": "645c7c7063dc82a0e044ae272a122d6c", - "yscatter_pivot_by_two_rows_and_two_columns": "1f1d66028e648bb7fcb5ef25efe21a4e", - "yscatter_sort_by_a_hidden_column": "6280b497dff50dd47d10fc2e0c86389f", - "yscatter_sort_by_a_numeric_column": "9915a48533fab3ad4f462858ca51278f", - "yscatter_sort_by_an_alpha_column": "4d7c1445db68215a63b934dc4dfb4cec", - "yscatter_filters_filters_by_a_numeric_column": "bcb141ab9fcca81d60aa55320cd55a38", - "yscatter_filters_filters_by_an_alpha_column": "17fb028b757aa18e67aece5c48609cd7", - "yscatter_filters_filters_with__in__comparator": "c673b728fa3992ff76e0808e413bf55c", - "sunburst_shows_a_grid_without_any_settings_applied": "233832500418cd2c6ee9fbe6e61228a8", - "sunburst_displays_visible_columns_": "1ccd4e9e5f1814d4bb1134506cc64ab7", - "sunburst_pivot_by_a_row": "970da574f3f2f8daa88f45c6b6df5b4b", - "sunburst_pivot_by_two_rows": "d50b92788a198165e3fe3060391b1e73", - "sunburst_pivot_by_a_column": "fc69bf198ab39a1fa7a22c850b6e778f", - "sunburst_pivot_by_a_row_and_a_column": "f94acbaa871416df05e11592d589796c", - "sunburst_pivot_by_two_rows_and_two_columns": "c6085f4f7729a9e0d3b6a6eb6e0e7a0d", - "sunburst_sort_by_a_hidden_column": "f20130534bd49d7b6c00efd0cf7166db", - "sunburst_sort_by_a_numeric_column": "b59aa81f013af39e57c12111ae4568be", - "sunburst_sort_by_an_alpha_column": "7d580735668589fbddbc7f9be734cd63", - "sunburst_filters_filters_by_a_numeric_column": "0494ab3b3da4e472ee7a127b105466f3", - "sunburst_filters_filters_by_an_alpha_column": "0f0b3be39aabc4ee7192e460503c17fd", - "sunburst_filters_filters_with__in__comparator": "fb5a14b48b5bb5cc6a8251325977e306", - "bar_rendering_bugs_correctly_render_when_a_bar_chart_has_non_equidistant_times_on_a_datetime_axis": "ab18f1d824e3c6e1d7190c92055e7e6f", - "area_shows_a_grid_without_any_settings_applied": "7288179f8d62d59e9f06af5fb34d3a11", - "area_displays_visible_columns_": "76d150d8c78be67cc489f3d1b2592fd4", - "area_pivot_by_a_row": "e12418f7de87289778a016cfb51c5c69", - "area_pivot_by_two_rows": "9582d7d9ab3dc15913dc00cdbde5eb38", - "area_pivot_by_a_column": "b91cd7979a377fa79cb75e58bdf99b96", - "area_pivot_by_a_row_and_a_column": "4ba334836ff9b22f6ecd62f0112ce677", - "area_pivot_by_two_rows_and_two_columns": "f6b3612822c4cd0899c76955bec6cc2d", - "area_sort_by_a_hidden_column": "1811658897b76d171402e1c5488105d3", - "area_sort_by_a_numeric_column": "a5b88c368844d6216e1ec726abebbcac", - "area_sort_by_an_alpha_column": "c5cffc9e167d3868b579206aa8a01829", - "area_filters_filters_by_a_numeric_column": "c5cffc9e167d3868b579206aa8a01829", - "area_filters_filters_by_an_alpha_column": "d9f6365ab79e552db8279afb6ba73f0d", - "area_filters_filters_with__in__comparator": "0cdad6c58612673b65a96f0ef59f6008", - "bar_shows_a_grid_without_any_settings_applied": "c99386c61ff7aecc2fe4d9d85772af07", - "bar_displays_visible_columns_": "7501b14c4a807973cae19099a9854f65", - "bar_pivot_by_a_row": "54a7f51d67f97cb0719097aed5b49a19", - "bar_pivot_by_two_rows": "8499a05639d25954124269032c481b4a", - "bar_pivot_by_a_column": "71406d3a50eb621e0ff3028a6c3d87b9", - "bar_pivot_by_a_row_and_a_column": "d936bc92d97e60f56231eee7b994986b", - "bar_pivot_by_two_rows_and_two_columns": "0d7ab6684d5bdf146d37ace33fd52c25", - "bar_sort_by_a_hidden_column": "543ecde5e1b6de2ee9d35eeb5e0a821a", - "bar_sort_by_a_numeric_column": "990e8466430887b1ba87e6349f3138fd", - "bar_sort_by_an_alpha_column": "829054c44b1e8ae512c6d353b3538425", - "bar_filters_filters_by_a_numeric_column": "c9e4e2fc4e1a12aa7684e8608f46c653", - "bar_filters_filters_by_an_alpha_column": "d586997539b9f76b0733efad0631749d", - "bar_filters_filters_with__in__comparator": "914b15437ab74e08463987f7d0166f05", - "bar-x_shows_a_grid_without_any_settings_applied": "5b63d415b0748811fbdfcc9ce086398b", - "bar-x_displays_visible_columns_": "12fca14c96609852c1b6d007ae0a4083", - "bar-x_pivot_by_a_row": "257a4b8db6e0aec9dac1d86e6b336399", - "bar-x_pivot_by_two_rows": "a1120e2686a3d17410d8455ab2770646", - "bar-x_pivot_by_a_column": "98ee6be6dbe80c0b857c51f6c1d3e133", - "bar-x_pivot_by_a_row_and_a_column": "a742747d1d7f09f51c2288402661b55c", - "bar-x_pivot_by_two_rows_and_two_columns": "fc3dc6894202c3fee260235df16120ab", - "bar-x_sort_by_a_hidden_column": "c784550e0490ebc92b2fd49139e2a39c", - "bar-x_sort_by_a_numeric_column": "dbb01375785c4661fa033ffa13378a39", - "bar-x_sort_by_an_alpha_column": "dd14b4d8f129eedb098612bf6b8ebe45", - "bar-x_filters_filters_by_a_numeric_column": "393c01647a62bd796d42ea80b9f5484d", - "bar-x_filters_filters_by_an_alpha_column": "123cbc1e09816ad82f64be48a9603d92", - "bar-x_filters_filters_with__in__comparator": "1d7ceade203a31e79e1484d277e0da58", - "bar-themed_shows_a_grid_without_any_settings_applied": "c99386c61ff7aecc2fe4d9d85772af07", - "bar-themed_displays_visible_columns_": "7501b14c4a807973cae19099a9854f65", - "bar-themed_pivot_by_a_row": "54a7f51d67f97cb0719097aed5b49a19", - "bar-themed_pivot_by_two_rows": "8499a05639d25954124269032c481b4a", - "bar-themed_pivot_by_a_column": "71406d3a50eb621e0ff3028a6c3d87b9", - "bar-themed_pivot_by_a_row_and_a_column": "d936bc92d97e60f56231eee7b994986b", - "bar-themed_pivot_by_two_rows_and_two_columns": "0d7ab6684d5bdf146d37ace33fd52c25", - "bar-themed_sort_by_a_hidden_column": "543ecde5e1b6de2ee9d35eeb5e0a821a", - "bar-themed_sort_by_a_numeric_column": "990e8466430887b1ba87e6349f3138fd", - "bar-themed_sort_by_an_alpha_column": "829054c44b1e8ae512c6d353b3538425", - "bar-themed_filters_filters_by_a_numeric_column": "c9e4e2fc4e1a12aa7684e8608f46c653", - "bar-themed_filters_filters_by_an_alpha_column": "d586997539b9f76b0733efad0631749d", - "bar-themed_filters_filters_with__in__comparator": "914b15437ab74e08463987f7d0166f05", - "xyline_correctly_render_when_a_bar_chart_has_non_equidistant_times_on_a_datetime_axis": "f420990315751370e1237e86b4043332", - "heatmap_by_a_numerical_column": "c978a9d898ac6dac8b32223aa97d2805" -} \ No newline at end of file diff --git a/packages/perspective-viewer-datagrid/test/results/results.json b/packages/perspective-viewer-datagrid/test/results/results.json deleted file mode 100644 index a035f4a8b0..0000000000 --- a/packages/perspective-viewer-datagrid/test/results/results.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "superstore_shows_a_grid_without_any_settings_applied_": "e469597235cc032619bc095a76f9ad6f", - "superstore_pivots_by_a_row_": "0c998898e8971224974fc55b4e7620e5", - "superstore_pivots_by_two_rows_": "f14c06e0fd50998a8e77804937d44687", - "superstore_pivots_by_a_column_": "e42f7ed1ee28b5af46cf79f45b909d7e", - "superstore_pivots_by_a_row_and_a_column_": "ee874bbd6a28c9ca57482739d53b2882", - "superstore_pivots_by_two_rows_and_two_columns_": "f0b137268a87b5bf843600f85fed0dd5", - "superstore_sorts_by_a_hidden_column_": "895863ac446e30f0770831a631371065", - "superstore_sorts_by_a_numeric_column_": "f70d391f8d1fbb40183fd20257bd14e8", - "superstore_filters_by_a_numeric_column_": "9e74934a1a08ee8c3664041672e4524c", - "superstore_filters_by_a_datetime_column_": "4f3ebe78d2092c8c6f74389778d764d5", - "superstore_highlights_invalid_filter_": "d74bde78c8afbd835e451fd5afffc9fe", - "superstore_sorts_by_an_alpha_column_": "e404bb87320c31ec31a54c8652ae439c", - "superstore_displays_visible_columns_": "09dd14f0e60da0e8749b7dd514e929f0", - "superstore_resets_viewable_area_when_the_logical_size_expands_": "e9dd1d275f46f6a0857e0168835d0b38", - "superstore_resets_viewable_area_when_the_physical_size_expands_": "e469597235cc032619bc095a76f9ad6f", - "__GIT_COMMIT__": "852ea8db97def4f349ee95958ebc99aa25e3b17e", - "superstore_shows_a_grid_without_any_settings_applied": "85d501c0fcd1c7535784b87223ab91be", - "superstore_pivot_by_a_row": "d984cb66a1dda226fa6054afb18f8c51", - "superstore_pivot_by_two_rows": "cb7dcd5720304954b2ae5fed1a0bbe68", - "superstore_pivot_by_a_column": "fad522ea89d419e6c0a3941f42eacb79", - "superstore_pivot_by_a_row_and_a_column": "2bd4081bc95e1d3092a911397a17e4c6", - "superstore_pivot_by_two_rows_and_two_columns": "b132fae1617dadb28fc57f464e7aae0e", - "superstore_sort_by_a_hidden_column": "ea26b15301b9893680476b9caf72d2f5", - "superstore_sort_by_a_numeric_column": "e0a9c978306629659b76ad9d51b3548e", - "superstore_sort_by_an_alpha_column": "238848930f3cd456204e23cfc82c18a9", - "superstore_filters_filters_by_a_numeric_column": "6c6ba00b6edf9ee11f82848b7786fd91", - "superstore_filters_filters_by_an_alpha_column": "4b9a40c2ffad050ff4cf059e22cb2b68", - "superstore_filters_filters_with__in__comparator": "1e46f8d9b53bcc44a682130e245d2380", - "superstore_perspective-config-update_event_is_fired_when_column_style_is_changed": "05537d516ca44f6646f6b6c2d842e3cf", - "superstore_Column_style_menu_opens_for_numeric_columns": "e3495e6d00ca07d402b38507a2a1e0bb", - "superstore_Column_style_menu_opens_for_string_columns": "b59930dfb9369da590452b2e202b1019" -} \ No newline at end of file diff --git a/packages/perspective-viewer-openlayers/test/results/results.json b/packages/perspective-viewer-openlayers/test/results/results.json deleted file mode 100644 index dd1ef9bfe8..0000000000 --- a/packages/perspective-viewer-openlayers/test/results/results.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "superstore_shows_a_grid_without_any_settings_applied": "80705a191c3675ed34d3058874f09a00", - "superstore_displays_visible_columns_": "80705a191c3675ed34d3058874f09a00", - "superstore_pivot_by_a_row": "80705a191c3675ed34d3058874f09a00", - "superstore_pivot_by_two_rows": "80705a191c3675ed34d3058874f09a00", - "superstore_pivot_by_a_column": "80705a191c3675ed34d3058874f09a00", - "superstore_pivot_by_a_row_and_a_column": "80705a191c3675ed34d3058874f09a00", - "superstore_pivot_by_two_rows_and_two_columns": "80705a191c3675ed34d3058874f09a00", - "superstore_sort_by_a_hidden_column": "80705a191c3675ed34d3058874f09a00", - "superstore_sort_by_a_numeric_column": "80705a191c3675ed34d3058874f09a00", - "superstore_sort_by_an_alpha_column": "80705a191c3675ed34d3058874f09a00", - "superstore_filters_filters_by_a_numeric_column": "80705a191c3675ed34d3058874f09a00", - "superstore_filters_filters_by_an_alpha_column": "80705a191c3675ed34d3058874f09a00", - "superstore_filters_filters_with__in__comparator": "80705a191c3675ed34d3058874f09a00", - "__GIT_COMMIT__": "ef6df703f94bdda20d81b476d8725782904357db" -} \ No newline at end of file diff --git a/packages/perspective-workspace/package.json b/packages/perspective-workspace/package.json index 2f3e75a6bd..a3187dee7a 100644 --- a/packages/perspective-workspace/package.json +++ b/packages/perspective-workspace/package.json @@ -22,16 +22,7 @@ "jsdelivr": "./dist/umd/perspective-workspace.js", "main": "./dist/umd/perspective-workspace.js", "scripts": { - "bench": "npm-run-all bench:build bench:run", - "bench:build": "echo \"No Benchmarks\"", - "bench:run": "echo \"No Benchmarks\"", "build": "node ./build.js", - "clean": "rimraf dist", - "clean:screenshots": "rimraf \"test/screenshots/**/*.@(failed|diff).png\"", - "test:run": "jest --rootDir=. --config=../../tools/perspective-test/jest.config.js --color", - "test:unit": "jest --color --config=./config/jest.unit.config.js 2>&1", - "test:integration": "jest --color --config=./config/jest.integration.config.js 2>&1", - "watch": "PSP_DEBUG=1 webpack --color --watch --config config/watch.config.js" }, "publishConfig": { "access": "public" diff --git a/packages/perspective/test/config/test_node.config.js b/packages/perspective/test/config/test_node.config.js deleted file mode 100644 index b98dc0c170..0000000000 --- a/packages/perspective/test/config/test_node.config.js +++ /dev/null @@ -1,17 +0,0 @@ -const path = require("path"); -const common = require("../../src/config/common.config.js"); - -module.exports = Object.assign({}, common({ no_minify: true }), { - entry: "./test/js/perspective.spec.js", - target: "node", - externals: [/^([a-z0-9]|\@(?!apache\-arrow)).*?(?!wasm)$/g], - node: { - __dirname: false, - __filename: false, - }, - output: { - filename: "perspective.spec.js", - path: path.resolve(__dirname, "../../build"), - libraryTarget: "umd", - }, -}); diff --git a/rust/perspective-viewer/package.json b/rust/perspective-viewer/package.json index 783495f520..a9180bab82 100644 --- a/rust/perspective-viewer/package.json +++ b/rust/perspective-viewer/package.json @@ -29,8 +29,7 @@ "types": "dist/esm/perspective-viewer.d.ts", "scripts": { "build": "node ./build.js", - "clean": "rimraf dist && rimraf pkg && rimraf build", - "clean:screenshots": "rimraf \"test/screenshots/**/*.@(failed|diff).png\"", + "clean": "rimraf dist && rimraf build", "docs": "npm-run-all docs:build docs:concat docs:deploy:*", "docs:build": "typedoc --hideBreadcrumbs --out dist/docs --readme none --excludePrivate src/ts/perspective-viewer.ts", "docs:concat": "node ./docs.js", @@ -38,10 +37,7 @@ "docs:deploy:exprtk": "cat exprtk.md > ../../docs/docs/obj/perspective-viewer-exprtk.md", "fix": "yarn lint --fix && cargo fmt", "lint": "prettier --check src/ts/**/*", - "test:run:rust": "rustup run nightly wasm-pack test --chrome --headless", - "test:run": "jest --rootDir=. --config=../../tools/perspective-test/jest.config.js --color --noStackTrace 2>&1", - "test:clean": "rm perspective.csv || true", - "test": "yarn test:build && npm-run-all -p test:run:rust && yarn test:clean" + "test:run:rust": "rustup run nightly wasm-pack test --chrome --headless" }, "publishConfig": { "access": "public" diff --git a/scripts/clean.js b/scripts/clean.js index 0c278ae7c7..2d34016fa5 100644 --- a/scripts/clean.js +++ b/scripts/clean.js @@ -7,26 +7,12 @@ * */ -const { clean, exec_with_scope, run_with_scope } = require("./script_utils.js"); +const { clean, run_with_scope } = require("./script_utils.js"); const glob = require("glob"); const minimatch = require("minimatch"); const args = process.argv.slice(2); -const IS_SCREENSHOTS = args.indexOf("--screenshots") !== -1; - -// Question: Cleaning of screenshots can be removed, because they are not currently -// used, right? -async function clean_screenshots(scope) { - if (args.indexOf("--all") !== -1) { - try { - exec_with_scope`npx rimraf test/screenshots`; - } catch (e) {} - } else { - await run_with_scope`clean:screenshots`; - } -} - async function run() { try { if (process.env.PSP_PROJECT === "python") { @@ -54,33 +40,24 @@ async function run() { ); } - let scope = - process.env.PACKAGE && process.env.PACKAGE !== "" - ? `${process.env.PACKAGE}` - : "*"; - - if (!IS_SCREENSHOTS) { - if ( - !process.env.PACKAGE || - minimatch("perspective", process.env.PACKAGE) - ) { - const files = [ - "CMakeFiles", - "build", - "cmake_install.cmake", - "CMakeCache.txt", - "compile_commands.json", - "libpsp.a", - "Makefile", - ]; - clean(...files.map((x) => `cpp/perspective/obj/${x}`)); - } - - await run_with_scope`clean`; - clean("docs/build", "docs/python", "docs/obj"); + if ( + !process.env.PACKAGE || + minimatch("perspective", process.env.PACKAGE) + ) { + const files = [ + "CMakeFiles", + "build", + "cmake_install.cmake", + "CMakeCache.txt", + "compile_commands.json", + "libpsp.a", + "Makefile", + ]; + clean(...files.map((x) => `cpp/perspective/obj/${x}`)); } - await clean_screenshots(scope); + await run_with_scope`clean`; + clean("docs/build", "docs/python", "docs/obj"); } catch (e) { console.error(e); process.exit(1); diff --git a/scripts/test_js.js b/scripts/test_js.js index 2d194036cf..61c912c747 100644 --- a/scripts/test_js.js +++ b/scripts/test_js.js @@ -49,14 +49,6 @@ function playwright(package, is_jlab) { ${args}`; } -function get_regex() { - const regex = getarg`-t`; - if (regex) { - console.log(`-- Qualifying search '${regex}'`); - return regex.replace(/ /g, "."); - } -} - async function run() { try { if (!IS_JUPYTER) { diff --git a/tools/perspective-test/playwright.config.ts b/tools/perspective-test/playwright.config.ts index f8aac89b5a..d9a9f2d43d 100644 --- a/tools/perspective-test/playwright.config.ts +++ b/tools/perspective-test/playwright.config.ts @@ -64,6 +64,10 @@ const BROWSER_PACKAGES = [ packageName: "perspective-workspace", testDir: "packages/perspective-workspace/test/js", }, + { + packageName: "perspective-cli", + testDir: "packages/perspective-cli/test/js", + }, ]; const NODE_PACKAGES = [ diff --git a/tools/perspective-test/src/js/global_startup.ts b/tools/perspective-test/src/js/global_startup.ts index 1a4a92bd37..8ce1e824ba 100644 --- a/tools/perspective-test/src/js/global_startup.ts +++ b/tools/perspective-test/src/js/global_startup.ts @@ -12,14 +12,14 @@ import fs from "fs"; import path from "path"; export default async function run() { - const results = path.join(__dirname, "../../results.tar.gz"); + const RESULTS_PATH = path.join(__dirname, "../../results.tar.gz"); try { - if (fs.existsSync(results)) { + if (fs.existsSync(RESULTS_PATH)) { console.log("Using results.tar.gz"); - await tar.extract({ file: results, gzip: true }); + await tar.extract({ file: RESULTS_PATH, gzip: true }); } } catch (e) { console.error("Failed to untar results archives"); - fs.unlinkSync(results); + fs.unlinkSync(RESULTS_PATH); } } diff --git a/tools/perspective-test/src/js/global_teardown.ts b/tools/perspective-test/src/js/global_teardown.ts index 8265c09792..6fe3bb6691 100644 --- a/tools/perspective-test/src/js/global_teardown.ts +++ b/tools/perspective-test/src/js/global_teardown.ts @@ -11,8 +11,10 @@ import tar from "tar"; import fs from "fs"; import path from "path"; +const RESULTS_PATH = path.join(__dirname, "../../results.tar.gz"); + export default async function run() { - if (fs.existsSync("../../results.tar.gz")) { + if (fs.existsSync(RESULTS_PATH)) { console.log("\nReplacing results.tar.gz"); } else { console.log("\nCreating results.tar.gz"); @@ -22,7 +24,7 @@ export default async function run() { tar.create( { gzip: true, - file: path.join(__dirname, "../../results.tar.gz"), + file: RESULTS_PATH, sync: false, portable: true, noMtime: true, From a3ebd97544e7d5b2c28b757ab42c556ed6c3fbec Mon Sep 17 00:00:00 2001 From: Andrew Stein Date: Thu, 27 Apr 2023 00:43:50 -0400 Subject: [PATCH 3/6] Remove UMD builds --- .prettierrc.json | 3 +- docs/build.js | 10 +- docs/docs/js.md | 40 +--- examples/blocks/index.js | 5 - examples/blocks/src/citibike/citibike.js | 2 + examples/blocks/src/citibike/index.html | 22 +-- examples/blocks/src/csv/csv.js | 4 +- examples/blocks/src/csv/index.html | 21 +- examples/blocks/src/evictions/index.html | 50 ++--- examples/blocks/src/fractal/index.html | 9 +- examples/blocks/src/fractal/index.js | 4 +- examples/blocks/src/olympics/index.html | 71 ++----- examples/blocks/src/streaming/index.html | 9 +- examples/blocks/src/streaming/streaming.js | 2 + examples/blocks/src/superstore/index.html | 13 +- examples/python-tornado-streaming/index.html | 25 +-- .../python-tornado/client_server_editing.html | 185 +++++++++--------- examples/python-tornado/index.html | 175 ++++++++--------- examples/python-tornado/server_mode.html | 83 ++++---- packages/perspective-esbuild-plugin/umd.js | 44 ----- packages/perspective-jupyterlab/build.js | 10 +- packages/perspective-jupyterlab/package.json | 5 +- .../perspective-jupyterlab/src/js/index.js | 2 +- .../src/js/notebook/index.js | 2 +- .../test/config/jupyter/jlab_start.js | 4 +- .../test/html/resize.html | 4 +- .../test/jupyter/utils.js | 6 +- packages/perspective-viewer-d3fc/build.js | 15 -- packages/perspective-viewer-d3fc/index.d.ts | 66 +++++++ packages/perspective-viewer-d3fc/package.json | 14 +- packages/perspective-viewer-datagrid/build.js | 15 -- .../perspective-viewer-datagrid/package.json | 10 +- .../perspective-viewer-openlayers/build.js | 11 -- .../perspective-viewer-openlayers/index.d.ts | 0 .../package.json | 14 +- packages/perspective-workspace/build.js | 14 -- packages/perspective-workspace/package.json | 11 +- packages/perspective/build.js | 8 +- packages/perspective/package.json | 10 +- rust/perspective-viewer/build.js | 11 +- rust/perspective-viewer/docs.js | 5 +- rust/perspective-viewer/package.json | 10 +- .../src/rust/custom_elements/viewer.rs | 14 +- rust/perspective-viewer/src/rust/lib.rs | 4 - .../perspective-bench/src/html/benchmark.html | 31 +-- 45 files changed, 431 insertions(+), 642 deletions(-) delete mode 100644 packages/perspective-esbuild-plugin/umd.js create mode 100644 packages/perspective-viewer-d3fc/index.d.ts create mode 100644 packages/perspective-viewer-openlayers/index.d.ts diff --git a/.prettierrc.json b/.prettierrc.json index e6b75e4bab..ab5734ae9b 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -4,7 +4,8 @@ { "files": ["*.html"], "options": { - "printWidth": 200 + "printWidth": 200, + "tabWidth": 4 } } ] diff --git a/docs/build.js b/docs/build.js index 2b1ad97669..c401b516ec 100644 --- a/docs/build.js +++ b/docs/build.js @@ -101,10 +101,9 @@ function template(is_dark) { - - - - + + + @@ -124,7 +123,8 @@ function template(is_dark) { - - - - - - -``` - -Once added to your page, you can access the engine's JavaScript API through the -`perspective` symbol and the browser's Custom Elements API: - -```html - -``` - -#### ESM - This build separates out Perspective's JavaScript, WebAssembly and various assets into individual files, allowing the browser to load them lazily, in parallel or not at all if needed. To use this build, you must include the diff --git a/examples/blocks/index.js b/examples/blocks/index.js index a0e77876e4..1043f003ec 100644 --- a/examples/blocks/index.js +++ b/examples/blocks/index.js @@ -9,11 +9,6 @@ const version = JSON.parse(fs.readFileSync("./package.json")).version; // directly to the assets. const replacements = { "/node_modules/": `https://cdn.jsdelivr.net/npm/`, - "perspective/dist/umd/perspective.js": `perspective@${version}`, - "perspective-viewer/dist/umd/perspective-viewer.js": `perspective-viewer@${version}`, - "perspective-viewer-datagrid/dist/umd/perspective-viewer-datagrid.js": `perspective-viewer-datagrid@${version}`, - "perspective-viewer-d3fc/dist/umd/perspective-viewer-d3fc.js": `perspective-viewer-d3fc@${version}`, - "perspective-workspace/dist/umd/perspective-workspace.js": `perspective-workspace@${version}`, "perspective/dist/cdn/perspective.js": `perspective@${version}/dist/cdn/perspective.js`, "perspective-viewer/dist/cdn/perspective-viewer.js": `perspective-viewer@${version}/dist/cdn/perspective-viewer.js`, "perspective-viewer-datagrid/dist/cdn/perspective-viewer-datagrid.js": `perspective-viewer-datagrid@${version}/dist/cdn/perspective-viewer-datagrid.js`, diff --git a/examples/blocks/src/citibike/citibike.js b/examples/blocks/src/citibike/citibike.js index 619e14baac..49b44195a4 100644 --- a/examples/blocks/src/citibike/citibike.js +++ b/examples/blocks/src/citibike/citibike.js @@ -1,3 +1,5 @@ +import perspective from "/node_modules/@finos/perspective/dist/cdn/perspective.js"; + // Quick wrapper function for making a GET call. function get(url) { return new Promise((resolve) => { diff --git a/examples/blocks/src/citibike/index.html b/examples/blocks/src/citibike/index.html index 42e8f14577..b31430d5ed 100644 --- a/examples/blocks/src/citibike/index.html +++ b/examples/blocks/src/citibike/index.html @@ -1,24 +1,16 @@ - + - + - - - - - + + + + - + - - - - + + + - + diff --git a/examples/blocks/src/streaming/streaming.js b/examples/blocks/src/streaming/streaming.js index 7a203c1df1..70e9bb3752 100644 --- a/examples/blocks/src/streaming/streaming.js +++ b/examples/blocks/src/streaming/streaming.js @@ -1,3 +1,5 @@ +import perspective from "/node_modules/@finos/perspective/dist/cdn/perspective.js"; + var SECURITIES = [ "AAPL.N", "AMZN.N", diff --git a/examples/blocks/src/superstore/index.html b/examples/blocks/src/superstore/index.html index 818080b191..8dc9c8e20a 100644 --- a/examples/blocks/src/superstore/index.html +++ b/examples/blocks/src/superstore/index.html @@ -5,11 +5,10 @@ - - - - - + + + + - - - - - - - - - - - - - \ No newline at end of file + + + + + diff --git a/examples/python-tornado/index.html b/examples/python-tornado/index.html index 6913ad0946..747f7c9154 100644 --- a/examples/python-tornado/index.html +++ b/examples/python-tornado/index.html @@ -9,92 +9,91 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + - - - - \ No newline at end of file + + + diff --git a/examples/python-tornado/server_mode.html b/examples/python-tornado/server_mode.html index cb85e82c7f..fdc4aa1282 100644 --- a/examples/python-tornado/server_mode.html +++ b/examples/python-tornado/server_mode.html @@ -9,39 +9,37 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + - - - - \ No newline at end of file + const table = websocket.open_table("data_source_one"); + + // Load this in the ``. + document.getElementById("viewer").load(table); + }); + + + diff --git a/packages/perspective-esbuild-plugin/umd.js b/packages/perspective-esbuild-plugin/umd.js deleted file mode 100644 index 295e06c056..0000000000 --- a/packages/perspective-esbuild-plugin/umd.js +++ /dev/null @@ -1,44 +0,0 @@ -const get_banner = ({ globalName }) => ({ - js: ` - (function (root, factory) { - if (typeof define === 'function' && define.amd) { - define(['exports'], factory); - } else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') { - factory(exports, module); - } else { - const exports = (root.${globalName} = {}); - const module = {exports} - factory(exports, module); - root.${globalName} = module.exports; - } - }(typeof self !== 'undefined' ? self : this, function (exports, module) { - `.trimStart(), -}); - -const get_footer = () => ({ - js: ` -})); -`.trimStart(), -}); - -exports.UMDLoader = function UMDLoader() { - function setup(build) { - const options = build.initialOptions; - if (options.globalName === undefined) { - console.warn("Setting `globalName` to `perspective`"); - options.globalName = "perspective"; - } - - options.banner = get_banner(options); - options.footer = get_footer(options); - if (options.format !== "cjs" && options.format !== undefined) { - console.warn("Setting options to `cjs` for `UMDLoader`"); - options.format = "cjs"; - } - } - - return { - name: "umd", - setup, - }; -}; diff --git a/packages/perspective-jupyterlab/build.js b/packages/perspective-jupyterlab/build.js index 1ab2e33400..e217aeae1c 100644 --- a/packages/perspective-jupyterlab/build.js +++ b/packages/perspective-jupyterlab/build.js @@ -2,7 +2,6 @@ const cpy_mod = import("cpy"); const { WasmPlugin } = require("@finos/perspective-esbuild-plugin/wasm"); const { WorkerPlugin } = require("@finos/perspective-esbuild-plugin/worker"); const { AMDLoader } = require("@finos/perspective-esbuild-plugin/amd"); -const { UMDLoader } = require("@finos/perspective-esbuild-plugin/umd"); const { build } = require("@finos/perspective-esbuild-plugin/build"); const path = require("path"); @@ -22,15 +21,15 @@ const TEST_BUILD = { define: { global: "window", }, - plugins: [WasmPlugin(true), WorkerPlugin({ inline: true }), UMDLoader()], + plugins: [WasmPlugin(true), WorkerPlugin({ inline: true })], globalName: "PerspectiveLumino", - format: "cjs", + format: "esm", loader: { ".html": "text", ".ttf": "file", ".css": "text", }, - outfile: "dist/umd/lumino.js", + outfile: "dist/esm/lumino.js", }; const LAB_BUILD = { @@ -46,7 +45,7 @@ const LAB_BUILD = { ".html": "text", ".ttf": "file", }, - outfile: "dist/umd/perspective-jupyterlab.js", + outfile: "dist/esm/perspective-jupyterlab.js", }; const NB_BUILDS = [ @@ -116,7 +115,6 @@ async function build_all() { ); await Promise.all(BUILD.map(build)).catch(() => process.exit(1)); - cpy(["dist/css/*"], "dist/umd"); cpy(["src/less/*"], "dist/less"); } diff --git a/packages/perspective-jupyterlab/package.json b/packages/perspective-jupyterlab/package.json index f32fdf5f64..cb5b1f1284 100644 --- a/packages/perspective-jupyterlab/package.json +++ b/packages/perspective-jupyterlab/package.json @@ -6,8 +6,8 @@ "dist/**/*", "src/**/*" ], - "main": "dist/umd/perspective-jupyterlab.js", - "style": "dist/umd/perspective-jupyterlab.css", + "main": "dist/esm/perspective-jupyterlab.js", + "style": "dist/css/perspective-jupyterlab.css", "directories": { "dist": "dist/" }, @@ -28,6 +28,7 @@ "clean:labextension": "rimraf ../../python/perspective/perspective/labextension", "clean:nbextension": "rimraf ../../python/perspective/perspective/nbextension/static", "test:build": "node build.js --test", + "test:jupyter:build": "cpy \"test/arrow/*\" dist/esm", "test:jupyter": "__JUPYTERLAB_PORT__=6538 npx playwright test --config ../../tools/perspective-test/playwright.config.js -- --jupyter", "test": "npm-run-all test:build", "version": "yarn build" diff --git a/packages/perspective-jupyterlab/src/js/index.js b/packages/perspective-jupyterlab/src/js/index.js index 3a17e9d116..2194268cc6 100644 --- a/packages/perspective-jupyterlab/src/js/index.js +++ b/packages/perspective-jupyterlab/src/js/index.js @@ -15,7 +15,7 @@ export * from "./widget"; import "@finos/perspective-viewer-datagrid"; import "@finos/perspective-viewer-d3fc"; -import "@finos/perspective-viewer-openlayers/dist/umd/perspective-viewer-openlayers.js"; +import "@finos/perspective-viewer-openlayers"; // NOTE: only expose the widget here import { PerspectiveJupyterPlugin } from "./plugin"; diff --git a/packages/perspective-jupyterlab/src/js/notebook/index.js b/packages/perspective-jupyterlab/src/js/notebook/index.js index 997c540fe5..08253548f6 100644 --- a/packages/perspective-jupyterlab/src/js/notebook/index.js +++ b/packages/perspective-jupyterlab/src/js/notebook/index.js @@ -9,7 +9,7 @@ import "@finos/perspective-viewer-datagrid"; import "@finos/perspective-viewer-d3fc"; -import "@finos/perspective-viewer-openlayers/dist/umd/perspective-viewer-openlayers.js"; +import "@finos/perspective-viewer-openlayers"; import { PerspectiveView } from "../view"; import { PerspectiveModel } from "../model"; diff --git a/packages/perspective-jupyterlab/test/config/jupyter/jlab_start.js b/packages/perspective-jupyterlab/test/config/jupyter/jlab_start.js index afab207465..615f481c69 100644 --- a/packages/perspective-jupyterlab/test/config/jupyter/jlab_start.js +++ b/packages/perspective-jupyterlab/test/config/jupyter/jlab_start.js @@ -76,8 +76,8 @@ exports.start_jlab = function () { "user_settings" ); - // Start jupyterlab with a root to dist/umd where the notebooks will be. - process.chdir(path.join(PACKAGE_ROOT, "dist", "umd")); + // Start jupyterlab with a root to dist/esm where the notebooks will be. + process.chdir(path.join(PACKAGE_ROOT, "dist", "esm")); console.log("Spawning Jupyterlab process"); diff --git a/packages/perspective-jupyterlab/test/html/resize.html b/packages/perspective-jupyterlab/test/html/resize.html index 65d04e8565..545205b3ab 100644 --- a/packages/perspective-jupyterlab/test/html/resize.html +++ b/packages/perspective-jupyterlab/test/html/resize.html @@ -10,10 +10,10 @@ - - - - + + + - +