// ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ // ┃ ██████ ██████ ██████ █ █ █ █ █ █▄ ▀███ █ ┃ // ┃ ▄▄▄▄▄█ █▄▄▄▄▄ ▄▄▄▄▄█ ▀▀▀▀▀█▀▀▀▀▀ █ ▀▀▀▀▀█ ████████▌▐███ ███▄ ▀█ █ ▀▀▀▀▀ ┃ // ┃ █▀▀▀▀▀ █▀▀▀▀▀ █▀██▀▀ ▄▄▄▄▄ █ ▄▄▄▄▄█ ▄▄▄▄▄█ ████████▌▐███ █████▄ █ ▄▄▄▄▄ ┃ // ┃ █ ██████ █ ▀█▄ █ ██████ █ ███▌▐███ ███████▄ █ ┃ // ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫ // ┃ Copyright (c) 2017, the Perspective Authors. ┃ // ┃ ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ┃ // ┃ This file is part of the Perspective library, distributed under the terms ┃ // ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃ // ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ import { execSync } from "child_process"; import { build } from "@perspective-dev/esbuild-plugin/build.js"; import { WorkerPlugin } from "@perspective-dev/esbuild-plugin/worker.js"; import { NodeModulesExternal } from "@perspective-dev/esbuild-plugin/external.js"; import * as fs from "node:fs"; import * as path from "node:path"; import { bundle as bundleCss, composeVisitors, bundleAsync as bundleAsyncCss, } from "lightningcss"; import { compress } from "pro_self_extracting_wasm"; import { get_host, inlineUrlVisitor, resolveNPM } from "./tools.mjs"; const IS_DEBUG = !!process.env.PSP_DEBUG || process.argv.indexOf("--debug") >= 0; const INHERIT = { stdio: "inherit", stderr: "inherit", }; export async function build_all() { if (!process.env.PSP_SKIP_WASM) { execSync( `cargo bundle --target=${get_host()} -- perspective_viewer ${IS_DEBUG ? "" : "--release"}`, INHERIT, ); await compress( "dist/wasm/perspective-viewer.wasm", "dist/wasm/perspective-viewer.wasm", ); } // JavaScript const BUILD = [ // WASM assets inlined into a single monolithic `.js` file. No special // loades required, this version of Perspective should be the easiest // to use but also the least performant at load time. // { // 'Import via `