diff --git a/.eslintrc.js b/.eslintrc.js index fdfae1a1a00d..cf6c3b95726c 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -194,7 +194,14 @@ module.exports = { }, overrides: [ { - files: ["**/*.config.js", "**/*.config.mjs", "**/*.config.cjs", "**/*.config.ts"], + files: [ + "**/*.config.js", + "**/*.config.mjs", + "**/*.config.cjs", + "**/*.config.ts", + "scripts/vitest/**/*.ts", + "scripts/vite/**/*.ts", + ], rules: { "@typescript-eslint/naming-convention": "off", // Allow require in CJS modules diff --git a/.gitignore b/.gitignore index 4f4289359a4c..775f46f6f235 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .__testdb* node_modules/ lib +dist .nyc_output/ coverage/** .DS_Store @@ -21,6 +22,7 @@ validators **/coverage **/node_modules **/lib +**/dist **/.nyc_output .tmp .vscode diff --git a/.wordlist.txt b/.wordlist.txt index b5517ed69db6..17a82cd917fc 100644 --- a/.wordlist.txt +++ b/.wordlist.txt @@ -98,6 +98,7 @@ blockRoot blockchain bootnode bootnodes +bundlers chainConfig chainsafe chiado @@ -193,11 +194,14 @@ testnets todo typesafe udp +unpkg util utils validator validators +vite vitest +webpack wip xcode yaml diff --git a/package.json b/package.json index fc26538e86c1..94e8733a64f0 100644 --- a/package.json +++ b/package.json @@ -51,8 +51,8 @@ "@types/node": "^20.11.28", "@typescript-eslint/eslint-plugin": "^7.2.0", "@typescript-eslint/parser": "^7.2.0", - "@vitest/coverage-v8": "^1.4.0", - "@vitest/browser": "^1.4.0", + "@vitest/coverage-v8": "^1.5.0", + "@vitest/browser": "^1.5.0", "crypto-browserify": "^3.12.0", "dotenv": "^16.4.5", "electron": "^26.2.2", @@ -71,6 +71,7 @@ "path-browserify": "^1.0.1", "prettier": "^3.2.5", "process": "^0.11.10", + "rollup-plugin-visualizer": "^5.12.0", "stream-browserify": "^3.0.0", "stream-http": "^3.2.0", "supertest": "^6.3.3", @@ -79,7 +80,8 @@ "typescript-docs-verifier": "^2.5.0", "vite-plugin-node-polyfills": "^0.21.0", "vite-plugin-top-level-await": "^1.4.1", - "vitest": "^1.4.0", + "vite": "^5.2.9", + "vitest": "^1.5.0", "vitest-when": "^0.3.1", "wait-port": "^1.1.0", "webdriverio": "^8.34.1" @@ -88,6 +90,6 @@ "@puppeteer/browsers": "^2.1.0", "dns-over-http-resolver": "^2.1.1", "loupe": "^2.3.6", - "vite": "^5.0.0" + "vite": "^5.2.9" } } diff --git a/packages/beacon-node/vitest.config.ts b/packages/beacon-node/vitest.config.ts index dbf15c3408f0..8e7179d112bd 100644 --- a/packages/beacon-node/vitest.config.ts +++ b/packages/beacon-node/vitest.config.ts @@ -1,5 +1,5 @@ import {defineConfig, mergeConfig} from "vitest/config"; -import {buildTargetPlugin} from "../../scripts/vitest/plugins/buildTargetPlugin.js"; +import {buildTargetPlugin} from "../../scripts/vite/plugins/buildTargetPlugin.js"; import vitestConfig from "../../vitest.base.unit.config"; export default mergeConfig( diff --git a/packages/beacon-node/vitest.e2e.config.ts b/packages/beacon-node/vitest.e2e.config.ts index 18034e3eedd1..cc2624760c29 100644 --- a/packages/beacon-node/vitest.e2e.config.ts +++ b/packages/beacon-node/vitest.e2e.config.ts @@ -1,5 +1,5 @@ import {defineConfig, mergeConfig} from "vitest/config"; -import {buildTargetPlugin} from "../../scripts/vitest/plugins/buildTargetPlugin"; +import {buildTargetPlugin} from "../../scripts/vite/plugins/buildTargetPlugin"; import vitestConfig from "../../vitest.base.e2e.config"; export default mergeConfig( diff --git a/packages/beacon-node/vitest.spec.config.ts b/packages/beacon-node/vitest.spec.config.ts index 5a34374d2374..5d957ef16057 100644 --- a/packages/beacon-node/vitest.spec.config.ts +++ b/packages/beacon-node/vitest.spec.config.ts @@ -1,5 +1,5 @@ import {defineConfig, mergeConfig} from "vitest/config"; -import {buildTargetPlugin} from "../../scripts/vitest/plugins/buildTargetPlugin"; +import {buildTargetPlugin} from "../../scripts/vite/plugins/buildTargetPlugin"; import vitestConfig from "../../vitest.base.spec.config"; export default mergeConfig( diff --git a/packages/light-client/README.md b/packages/light-client/README.md index c9c3e0c2a840..0129fbd9714f 100644 --- a/packages/light-client/README.md +++ b/packages/light-client/README.md @@ -41,14 +41,14 @@ It is possible to start up the light-client as a standalone process. ```bash lodestar lightclient \ - --network mainnet \ - --beacon-api-url https://beacon-node.your-domain.com \ + --network sepolia \ + --beacon-api-url https://lodestar-sepolia.chainsafe.io \ --checkpoint-root "0xccaff4b99986a7b05e06738f1828a32e40799b277fd9f9ff069be55341fe0229" ``` ## Light-Client Programmatic Example -For this example we will assume there is a running beacon node at `https://beacon-node.your-domain.com` +For this example we will assume there is a running beacon node at `https://lodestar-sepolia.chainsafe.io` If you are running light-client on a server/node environment there is a faster version of bls that can help with performance. It is a peerDependency and needs to be installed separately by the consumer of this package. This was done so that for browser situations there is not a hard requirement for node-only code that will cause bundling errors. On startup, if running in a node environment, and `@chainsafe/blst` is installed the LightClient will automatically use the faster bls bindings. @@ -57,16 +57,19 @@ npm i -S @chainsafe/blst ``` ```ts -import {getClient} from "@lodestar/api"; -import {createChainForkConfig} from "@lodestar/config"; -import {networksChainConfig} from "@lodestar/config/networks"; import {Lightclient, LightclientEvent} from "@lodestar/light-client"; import {LightClientRestTransport} from "@lodestar/light-client/transport"; -import {getFinalizedSyncCheckpoint, getGenesisData, getLcLoggerConsole} from "@lodestar/light-client/utils"; - -const config = createChainForkConfig(networksChainConfig.mainnet); -const logger = getLcLoggerConsole({logDebug: Boolean(process.env.DEBUG)}); -const api = getClient({urls: ["https://beacon-node.your-domain.com"]}, {config}); +import { + getFinalizedSyncCheckpoint, + getGenesisData, + getConsoleLogger, + getApiFromUrl, + getChainForkConfigFromNetwork, +} from "@lodestar/light-client/utils"; + +const config = getChainForkConfigFromNetwork("sepolia"); +const logger = getConsoleLogger({logDebug: Boolean(process.env.DEBUG)}); +const api = getApiFromUrl({urls: ["https://lodestar-sepolia.chainsafe.io"]}, {config}); const lightclient = await Lightclient.initializeFromCheckpointRoot({ config, @@ -94,6 +97,31 @@ lightclient.emitter.on(LightclientEvent.lightClientOptimisticHeader, async (opti }); ``` +## Browser Integration + +If you want to use Lightclient in browser and facing some issues in building it with bundlers like webpack, vite. We suggest to use our distribution build. The support for single distribution build is started from `1.19.0` version. + +Directly link the dist build with the ` +``` + ## Contributors Read our [contribution documentation](https://chainsafe.github.io/lodestar/contribution/getting-started), [submit an issue](https://github.com/ChainSafe/lodestar/issues/new/choose) or talk to us on our [discord](https://discord.gg/yjyvFRP)! diff --git a/packages/light-client/package.json b/packages/light-client/package.json index a6707b91b391..6f74f8bc28b1 100644 --- a/packages/light-client/package.json +++ b/packages/light-client/package.json @@ -45,13 +45,20 @@ "lib/**/*.js", "lib/**/*.js.map", "*.d.ts", - "*.js" + "*.js", + "dist/**/*.js", + "dist/**/*.mjs", + "dist/**/*.cjs", + "dist/**/*.map", + "dist/**/*.json", + "dist/**/*.d.ts" ], "scripts": { "clean": "rm -rf lib && rm -f *.tsbuildinfo", "build": "tsc -p tsconfig.build.json", + "build:dist": "vite build", "build:watch": "yarn run build --watch", - "build:release": "yarn clean && yarn run build", + "build:release": "yarn clean && yarn run build && yarn run build:dist", "check-build": "node -e \"(async function() { await import('./lib/index.js') })()\"", "check-types": "tsc", "lint": "eslint --color --ext .ts src/ test/", @@ -59,8 +66,8 @@ "test": "yarn test:unit", "test:unit": "vitest --run --dir test/unit/", "test:browsers": "yarn test:browsers:chrome && yarn test:browsers:firefox && yarn test:browsers:electron", - "test:browsers:chrome": "vitest --run --browser chrome --config ./vitest.browser.config.ts --dir test/unit", - "test:browsers:firefox": "vitest --run --browser firefox --config ./vitest.browser.config.ts --dir test/unit", + "test:browsers:chrome": "yarn run build:dist && vitest --run --browser chrome --config ./vitest.browser.config.ts --dir test/unit", + "test:browsers:firefox": "yarn run build:dist && vitest --run --browser firefox --config ./vitest.browser.config.ts --dir test/unit", "test:browsers:electron": "echo 'Electron tests will be introduced back in the future as soon vitest supports electron.'", "check-readme": "typescript-docs-verifier" }, diff --git a/packages/light-client/src/index.ts b/packages/light-client/src/index.ts index 7fe6332895af..f9b9ade05620 100644 --- a/packages/light-client/src/index.ts +++ b/packages/light-client/src/index.ts @@ -7,7 +7,7 @@ import {isErrorAborted, sleep} from "@lodestar/utils"; import {getCurrentSlot, slotWithFutureTolerance, timeUntilNextEpoch} from "./utils/clock.js"; import {chunkifyInclusiveRange} from "./utils/chunkify.js"; import {LightclientEmitter, LightclientEvent} from "./events.js"; -import {getLcLoggerConsole, ILcLogger} from "./utils/logger.js"; +import {getConsoleLogger, ILcLogger} from "./utils/logger.js"; import {computeSyncPeriodAtEpoch, computeSyncPeriodAtSlot, computeEpochAtSlot} from "./utils/clock.js"; import {LightclientSpec} from "./spec/index.js"; import {validateLightClientBootstrap} from "./spec/validateLightClientBootstrap.js"; @@ -114,7 +114,7 @@ export class Lightclient { : genesisData.genesisValidatorsRoot; this.config = createBeaconConfig(config, this.genesisValidatorsRoot); - this.logger = logger ?? getLcLoggerConsole(); + this.logger = logger ?? getConsoleLogger(); this.transport = transport; this.runStatus = {code: RunStatusCode.uninitialized}; @@ -318,3 +318,8 @@ export class Lightclient { this.emitter.emit(LightclientEvent.statusChange, this.runStatus.code); } } + +// To export these name spaces to the bundle JS +export * as utils from "./utils.js"; +export * as validation from "./validation.js"; +export * as transport from "./transport.js"; diff --git a/packages/light-client/src/transport.ts b/packages/light-client/src/transport.ts new file mode 100644 index 000000000000..b39186faded4 --- /dev/null +++ b/packages/light-client/src/transport.ts @@ -0,0 +1,2 @@ +// This file exists to have proper namespace for the web bundle +export * from "./transport/index.js"; diff --git a/packages/light-client/src/utils.ts b/packages/light-client/src/utils.ts new file mode 100644 index 000000000000..eaa5264eb4cb --- /dev/null +++ b/packages/light-client/src/utils.ts @@ -0,0 +1,2 @@ +// This file exists to have proper namespace for the web bundle +export * from "./utils/index.js"; diff --git a/packages/light-client/src/utils/api.ts b/packages/light-client/src/utils/api.ts new file mode 100644 index 000000000000..bcc8a4d4f29c --- /dev/null +++ b/packages/light-client/src/utils/api.ts @@ -0,0 +1,19 @@ +import {getClient, Api} from "@lodestar/api"; +import {ChainForkConfig, createChainForkConfig} from "@lodestar/config"; +import {NetworkName, networksChainConfig} from "@lodestar/config/networks"; + +export function getApiFromUrl(url: string, network: NetworkName): Api { + if (!(network in networksChainConfig)) { + throw Error(`Invalid network name "${network}". Valid options are: ${Object.keys(networksChainConfig).join()}`); + } + + return getClient({urls: [url]}, {config: createChainForkConfig(networksChainConfig[network])}); +} + +export function getChainForkConfigFromNetwork(network: NetworkName): ChainForkConfig { + if (!(network in networksChainConfig)) { + throw Error(`Invalid network name "${network}". Valid options are: ${Object.keys(networksChainConfig).join()}`); + } + + return createChainForkConfig(networksChainConfig[network]); +} diff --git a/packages/light-client/src/utils/index.ts b/packages/light-client/src/utils/index.ts index 145e6fe52c9a..6c49c7ed11f9 100644 --- a/packages/light-client/src/utils/index.ts +++ b/packages/light-client/src/utils/index.ts @@ -1,3 +1,4 @@ +export * from "./api.js"; export * from "./chunkify.js"; export * from "./clock.js"; export * from "./domain.js"; diff --git a/packages/light-client/src/utils/logger.ts b/packages/light-client/src/utils/logger.ts index cb47857da165..afdbf7da7d3d 100644 --- a/packages/light-client/src/utils/logger.ts +++ b/packages/light-client/src/utils/logger.ts @@ -13,7 +13,7 @@ export type ILcLogger = { /** * With `console` module and ignoring debug logs */ -export function getLcLoggerConsole(opts?: {logDebug?: boolean}): ILcLogger { +export function getConsoleLogger(opts?: {logDebug?: boolean}): ILcLogger { return { error: console.error, warn: console.warn, @@ -21,3 +21,8 @@ export function getLcLoggerConsole(opts?: {logDebug?: boolean}): ILcLogger { debug: opts?.logDebug ? console.log : () => {}, }; } + +/** + * @deprecated - Use `getConsoleLogger` instead. + */ +export const getLcLoggerConsole = getConsoleLogger; diff --git a/packages/light-client/test/unit/webEsmBundle.browser.test.ts b/packages/light-client/test/unit/webEsmBundle.browser.test.ts new file mode 100644 index 000000000000..1f9e95a90166 --- /dev/null +++ b/packages/light-client/test/unit/webEsmBundle.browser.test.ts @@ -0,0 +1,63 @@ +/* eslint-disable @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call */ +import {expect, describe, it, beforeEach, vi} from "vitest"; +import "../../dist/lightclient.min.mjs"; + +describe("web bundle for lightclient", () => { + vi.setConfig({testTimeout: 20_000}); + + let lightclient: any; + + beforeEach(() => { + lightclient = (window as any)["lodestar"]["lightclient"]; + }); + + it("should have a global interface", () => { + expect(lightclient).toBeDefined(); + }); + + it("should have all relevant exports", () => { + expect(lightclient).toHaveProperty("Lightclient"); + expect(lightclient).toHaveProperty("LightclientEvent"); + expect(lightclient).toHaveProperty("RunStatusCode"); + expect(lightclient).toHaveProperty("upgradeLightClientFinalityUpdate"); + expect(lightclient).toHaveProperty("upgradeLightClientOptimisticUpdate"); + expect(lightclient).toHaveProperty("utils"); + expect(lightclient).toHaveProperty("transport"); + expect(lightclient).toHaveProperty("validation"); + + expect(lightclient.Lightclient).toBeTypeOf("function"); + }); + + it("should start the lightclient and sync", async () => { + const {Lightclient, LightclientEvent, transport, utils} = lightclient; + + const logger = utils.getConsoleLogger({logDebug: true}); + const config = utils.getChainForkConfigFromNetwork("mainnet"); + + // TODO: Decide to check which node to use in testing + // We have one node in CI, but that only starts with e2e tests + const api = utils.getApiFromUrl("https://lodestar-mainnet.chainsafe.io", "mainnet"); + + const lc = await Lightclient.initializeFromCheckpointRoot({ + config, + logger, + transport: new transport.LightClientRestTransport(api), + genesisData: await utils.getGenesisData(api), + checkpointRoot: await utils.getFinalizedSyncCheckpoint(api), + opts: { + allowForcedUpdates: true, + updateHeadersOnForcedUpdate: true, + }, + }); + + await expect(lc.start()).resolves.toBeUndefined(); + + await expect( + new Promise((resolve) => { + lc.emitter.on(LightclientEvent.lightClientOptimisticHeader, async (optimisticUpdate: unknown) => { + resolve(optimisticUpdate); + }); + }) + ).resolves.toBeDefined(); + }); +}); diff --git a/packages/light-client/test/utils/utils.ts b/packages/light-client/test/utils/utils.ts index 930cabfdad11..a99004345217 100644 --- a/packages/light-client/test/utils/utils.ts +++ b/packages/light-client/test/utils/utils.ts @@ -14,7 +14,7 @@ import { import {altair, phase0, Slot, ssz, SyncPeriod, allForks} from "@lodestar/types"; import {SyncCommitteeFast} from "../../src/types.js"; import {computeSigningRoot} from "../../src/utils/domain.js"; -import {getLcLoggerConsole} from "../../src/utils/logger.js"; +import {getConsoleLogger} from "../../src/utils/logger.js"; const CURRENT_SYNC_COMMITTEE_INDEX = 22; const CURRENT_SYNC_COMMITTEE_DEPTH = 5; @@ -25,7 +25,7 @@ const CURRENT_SYNC_COMMITTEE_DEPTH = 5; * DEBUG=true vitest ... * ``` */ -export const testLogger = getLcLoggerConsole({logDebug: Boolean(process.env.DEBUG)}); +export const testLogger = getConsoleLogger({logDebug: Boolean(process.env.DEBUG)}); export const genesisValidatorsRoot = Buffer.alloc(32, 0xaa); export const SOME_HASH = Buffer.alloc(32, 0xaa); diff --git a/packages/light-client/tsconfig.json b/packages/light-client/tsconfig.json index b29a7b46c4b1..cfcb3522f506 100644 --- a/packages/light-client/tsconfig.json +++ b/packages/light-client/tsconfig.json @@ -1,4 +1,5 @@ { "extends": "../../tsconfig.json", + "exclude": ["src/index.browser.ts"], "compilerOptions": {} } diff --git a/packages/light-client/vite.config.ts b/packages/light-client/vite.config.ts new file mode 100644 index 000000000000..e19e6d74e279 --- /dev/null +++ b/packages/light-client/vite.config.ts @@ -0,0 +1,29 @@ +import {defineConfig, mergeConfig} from "vite"; +import {getBaseViteConfig} from "../../vite.base.config.js"; + +import pkgJSON from "./package.json"; + +export default mergeConfig( + getBaseViteConfig(pkgJSON, {libName: "LightClient", entry: "src/index.ts"}), + defineConfig({ + build: { + rollupOptions: { + output: { + footer: ` + globalThis.lodestar = globalThis.lodestar === undefined ? {} : globalThis.lodestar; + globalThis.lodestar.lightclient = { + Lightclient, + LightclientEvent, + RunStatusCode, + upgradeLightClientFinalityUpdate, + upgradeLightClientOptimisticUpdate, + utils, + transport, + validation + }; + `, + }, + }, + }, + }) +); diff --git a/scripts/vite/plugins/blsBrowserPlugin.ts b/scripts/vite/plugins/blsBrowserPlugin.ts new file mode 100644 index 000000000000..88c850f3fd1b --- /dev/null +++ b/scripts/vite/plugins/blsBrowserPlugin.ts @@ -0,0 +1,31 @@ +import path from "node:path"; +import {UserConfig, ConfigEnv, Plugin} from "vite"; +const __dirname = new URL(".", import.meta.url).pathname; +const polyfillsDir = path.join(__dirname, "../polyfills"); + +const emptyModulePath = path.join(__dirname, "../polyfills/emptyModule.js"); + +export function blsBrowserPlugin(): Plugin { + return { + name: "blsBrowserPlugin", + config(_config: UserConfig, _env: ConfigEnv) { + return { + optimizeDeps: { + force: true, + }, + resolve: { + alias: { + "@chainsafe/bls/types": "@chainsafe/bls/types", + "@chainsafe/bls": "@chainsafe/bls/herumi", + // This is just used to generate `privateKey` which is not used in the browser. + "@chainsafe/bls-keygen": path.join(polyfillsDir, "bls-keygen.js"), + "@chainsafe/blst": emptyModulePath, + "@chainsafe/bls-hd-key": emptyModulePath, + crypto: emptyModulePath, + "node:crypto": emptyModulePath, + }, + }, + }; + }, + }; +} diff --git a/scripts/vitest/plugins/buildTargetPlugin.ts b/scripts/vite/plugins/buildTargetPlugin.ts similarity index 100% rename from scripts/vitest/plugins/buildTargetPlugin.ts rename to scripts/vite/plugins/buildTargetPlugin.ts diff --git a/scripts/vite/polyfills/bls-keygen.js b/scripts/vite/polyfills/bls-keygen.js new file mode 100644 index 000000000000..779e200eb942 --- /dev/null +++ b/scripts/vite/polyfills/bls-keygen.js @@ -0,0 +1 @@ +export function generateRandomSecretKey() {} diff --git a/scripts/vite/polyfills/emptyModule.js b/scripts/vite/polyfills/emptyModule.js new file mode 100644 index 000000000000..ff8b4c56321a --- /dev/null +++ b/scripts/vite/polyfills/emptyModule.js @@ -0,0 +1 @@ +export default {}; diff --git a/scripts/vitest/polyfills/perf_hooks.js b/scripts/vite/polyfills/perf_hooks.js similarity index 100% rename from scripts/vitest/polyfills/perf_hooks.js rename to scripts/vite/polyfills/perf_hooks.js diff --git a/scripts/vitest/setupFiles/customMatchers.ts b/scripts/vitest/setupFiles/customMatchers.ts index 227c0a2c0c76..25ffeb624226 100644 --- a/scripts/vitest/setupFiles/customMatchers.ts +++ b/scripts/vitest/setupFiles/customMatchers.ts @@ -1,4 +1,3 @@ -// eslint-disable-next-line import/no-extraneous-dependencies import {expect} from "vitest"; expect.extend({ diff --git a/vite.base.config.ts b/vite.base.config.ts new file mode 100644 index 000000000000..d981826e3b48 --- /dev/null +++ b/vite.base.config.ts @@ -0,0 +1,78 @@ +import {UserConfig, defineConfig} from "vite"; +import {nodePolyfills} from "vite-plugin-node-polyfills"; +import {visualizer} from "rollup-plugin-visualizer"; +import topLevelAwait from "vite-plugin-top-level-await"; +import {blsBrowserPlugin} from "./scripts/vite/plugins/blsBrowserPlugin.js"; + +export function getBaseViteConfig( + pkgInfo: { + description: string; + version: string; + author: string; + license: string; + homepage: string; + }, + {entry, libName}: {entry: string; libName: string} +): UserConfig { + // TODO: Investigate why this banner is not appended to the build header. + const banner = + `/* ${pkgInfo.description}\n` + + " * \n" + + ` * Version: ${pkgInfo.version}\n` + + ` * Author: ${pkgInfo.author}\n` + + ` * License: ${pkgInfo.license}\n` + + ` * Web: ${pkgInfo.homepage}\n` + + "*/"; + + return defineConfig({ + plugins: [ + topLevelAwait(), + blsBrowserPlugin(), + nodePolyfills({ + include: ["http", "https", "stream"], + globals: {Buffer: true, process: true}, + protocolImports: true, + }), + ...(process.env.CI ? [] : [visualizer()]), + ], + mode: "production", + appType: "custom", + esbuild: { + banner, + legalComments: "none", + }, + build: { + // "modules" refer to ['es2020', 'edge88', 'firefox78', 'chrome87', 'safari14'] + target: "modules", + outDir: "dist", + sourcemap: true, + minify: true, + manifest: "manifest.json", + ssr: false, + ssrManifest: false, + emptyOutDir: true, + lib: { + entry, + formats: ["es"], + name: libName, + fileName: (format) => { + if (format === "esm" || format === "es") { + return `${libName.toLowerCase()}.min.mjs`; + } else if (format === "cjs") { + return `${libName.toLowerCase()}.min.cjs`; + } else { + return `${libName.toLowerCase()}.min.${format}.js`; + } + }, + }, + rollupOptions: { + output: { + inlineDynamicImports: true, + }, + treeshake: { + preset: "recommended", + }, + }, + }, + }); +} diff --git a/vitest.base.browser.config.ts b/vitest.base.browser.config.ts index a07f4d842b06..edd53c406ae1 100644 --- a/vitest.base.browser.config.ts +++ b/vitest.base.browser.config.ts @@ -3,10 +3,12 @@ import {defineConfig} from "vitest/config"; const __dirname = new URL(".", import.meta.url).pathname; import {nodePolyfills} from "vite-plugin-node-polyfills"; import topLevelAwait from "vite-plugin-top-level-await"; +import { blsBrowserPlugin } from "./scripts/vite/plugins/blsBrowserPlugin"; export default defineConfig({ plugins: [ topLevelAwait(), + blsBrowserPlugin(), nodePolyfills({ include: ["buffer", "process", "util", "string_decoder", "url", "querystring", "events"], globals: {Buffer: true, process: true}, diff --git a/yarn.lock b/yarn.lock index 4faf0ea94bb3..559145aca02a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1329,7 +1329,7 @@ "@jridgewell/sourcemap-codec" "^1.4.10" "@jridgewell/trace-mapping" "^0.3.9" -"@jridgewell/resolve-uri@3.1.0", "@jridgewell/resolve-uri@^3.0.3": +"@jridgewell/resolve-uri@^3.0.3": version "3.1.0" resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz#2203b118c157721addfe69d47b70465463066d78" integrity sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w== @@ -1344,7 +1344,7 @@ resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72" integrity sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw== -"@jridgewell/sourcemap-codec@1.4.14", "@jridgewell/sourcemap-codec@^1.4.10": +"@jridgewell/sourcemap-codec@^1.4.10": version "1.4.14" resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz#add4c98d341472a289190b424efbdb096991bb24" integrity sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw== @@ -1362,14 +1362,6 @@ "@jridgewell/resolve-uri" "^3.0.3" "@jridgewell/sourcemap-codec" "^1.4.10" -"@jridgewell/trace-mapping@^0.3.12": - version "0.3.18" - resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.18.tgz#25783b2086daf6ff1dcb53c9249ae480e4dd4cd6" - integrity sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA== - dependencies: - "@jridgewell/resolve-uri" "3.1.0" - "@jridgewell/sourcemap-codec" "1.4.14" - "@jridgewell/trace-mapping@^0.3.23": version "0.3.25" resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz#15f190e98895f3fc23276ee14bc76b675c2e50f0" @@ -2923,11 +2915,6 @@ "@types/through" "*" rxjs "^7.2.0" -"@types/istanbul-lib-coverage@^2.0.1": - version "2.0.4" - resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz#8467d4b3c087805d63580480890791277ce35c44" - integrity sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g== - "@types/js-yaml@^4.0.5": version "4.0.5" resolved "https://registry.yarnpkg.com/@types/js-yaml/-/js-yaml-4.0.5.tgz#738dd390a6ecc5442f35e7f03fa1431353f7e138" @@ -2938,6 +2925,11 @@ resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.13.tgz#02c24f4363176d2d18fc8b70b9f3c54aba178a85" integrity sha512-RbSSoHliUbnXj3ny0CNFOoxrIDV6SUGyStHsvDqosw6CkdPV8TtWGlfecuK4ToyMEAql6pzNxgCFKanovUzlgQ== +"@types/json-schema@^7.0.15": + version "7.0.15" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" + integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== + "@types/json5@^0.0.29": version "0.0.29" resolved "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz" @@ -3065,6 +3057,11 @@ resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.2.tgz#31f6eec1ed7ec23f4f05608d3a2d381df041f564" integrity sha512-7aqorHYgdNO4DM36stTiGO3DvKoex9TQRwsJU6vMaFGyqpBA1MNZkz+PG3gaNUPpTAOYhT1WR7M1JyA3fbS9Cw== +"@types/semver@^7.5.8": + version "7.5.8" + resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.8.tgz#8268a8c57a3e4abd25c165ecd36237db7948a55e" + integrity sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ== + "@types/sinon@^17.0.0": version "17.0.2" resolved "https://registry.yarnpkg.com/@types/sinon/-/sinon-17.0.2.tgz#9a769f67e62b45b7233f1fe01cb1f231d2393e1c" @@ -3206,6 +3203,14 @@ "@typescript-eslint/types" "7.2.0" "@typescript-eslint/visitor-keys" "7.2.0" +"@typescript-eslint/scope-manager@7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-7.7.0.tgz#3f0db079b275bb8b0cb5be7613fb3130cfb5de77" + integrity sha512-/8INDn0YLInbe9Wt7dK4cXLDYp0fNHP5xKLHvZl3mOT5X17rK/YShXaiNmorl+/U4VKCVIjJnx4Ri5b0y+HClw== + dependencies: + "@typescript-eslint/types" "7.7.0" + "@typescript-eslint/visitor-keys" "7.7.0" + "@typescript-eslint/type-utils@7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-7.2.0.tgz#7be5c30e9b4d49971b79095a1181324ef6089a19" @@ -3221,6 +3226,11 @@ resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-7.2.0.tgz#0feb685f16de320e8520f13cca30779c8b7c403f" integrity sha512-XFtUHPI/abFhm4cbCDc5Ykc8npOKBSJePY3a3s+lwumt7XWJuzP5cZcfZ610MIPHjQjNsOLlYK8ASPaNG8UiyA== +"@typescript-eslint/types@7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-7.7.0.tgz#23af4d24bf9ce15d8d301236e3e3014143604f27" + integrity sha512-G01YPZ1Bd2hn+KPpIbrAhEWOn5lQBrjxkzHkWvP6NucMXFtfXoevK82hzQdpfuQYuhkvFDeQYbzXCjR1z9Z03w== + "@typescript-eslint/typescript-estree@7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-7.2.0.tgz#5beda2876c4137f8440c5a84b4f0370828682556" @@ -3235,7 +3245,21 @@ semver "^7.5.4" ts-api-utils "^1.0.1" -"@typescript-eslint/utils@7.2.0", "@typescript-eslint/utils@^7.1.1": +"@typescript-eslint/typescript-estree@7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-7.7.0.tgz#b5dd6383b4c6a852d7b256a37af971e8982be97f" + integrity sha512-8p71HQPE6CbxIBy2kWHqM1KGrC07pk6RJn40n0DSc6bMOBBREZxSDJ+BmRzc8B5OdaMh1ty3mkuWRg4sCFiDQQ== + dependencies: + "@typescript-eslint/types" "7.7.0" + "@typescript-eslint/visitor-keys" "7.7.0" + debug "^4.3.4" + globby "^11.1.0" + is-glob "^4.0.3" + minimatch "^9.0.4" + semver "^7.6.0" + ts-api-utils "^1.3.0" + +"@typescript-eslint/utils@7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-7.2.0.tgz#fc8164be2f2a7068debb4556881acddbf0b7ce2a" integrity sha512-YfHpnMAGb1Eekpm3XRK8hcMwGLGsnT6L+7b2XyRv6ouDuJU1tZir1GS2i0+VXRatMwSI1/UfcyPe53ADkU+IuA== @@ -3248,6 +3272,19 @@ "@typescript-eslint/typescript-estree" "7.2.0" semver "^7.5.4" +"@typescript-eslint/utils@^7.1.1": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-7.7.0.tgz#3d2b6606a60ac34f3c625facfb3b3ab7e126f58d" + integrity sha512-LKGAXMPQs8U/zMRFXDZOzmMKgFv3COlxUQ+2NMPhbqgVm6R1w+nU1i4836Pmxu9jZAuIeyySNrN/6Rc657ggig== + dependencies: + "@eslint-community/eslint-utils" "^4.4.0" + "@types/json-schema" "^7.0.15" + "@types/semver" "^7.5.8" + "@typescript-eslint/scope-manager" "7.7.0" + "@typescript-eslint/types" "7.7.0" + "@typescript-eslint/typescript-estree" "7.7.0" + semver "^7.6.0" + "@typescript-eslint/visitor-keys@7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-7.2.0.tgz#5035f177752538a5750cca1af6044b633610bf9e" @@ -3256,24 +3293,32 @@ "@typescript-eslint/types" "7.2.0" eslint-visitor-keys "^3.4.1" +"@typescript-eslint/visitor-keys@7.7.0": + version "7.7.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-7.7.0.tgz#950148cf1ac11562a2d903fdf7acf76714a2dc9e" + integrity sha512-h0WHOj8MhdhY8YWkzIF30R379y0NqyOHExI9N9KCzvmu05EgG4FumeYa3ccfKUSphyWkWQE1ybVrgz/Pbam6YA== + dependencies: + "@typescript-eslint/types" "7.7.0" + eslint-visitor-keys "^3.4.3" + "@ungap/structured-clone@^1.2.0": version "1.2.0" resolved "https://registry.yarnpkg.com/@ungap/structured-clone/-/structured-clone-1.2.0.tgz#756641adb587851b5ccb3e095daf27ae581c8406" integrity sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ== -"@vitest/browser@^1.4.0": - version "1.4.0" - resolved "https://registry.yarnpkg.com/@vitest/browser/-/browser-1.4.0.tgz#c210b235eecc602615f6970d6036d37b79fb1dc9" - integrity sha512-kC44DzuqPZZrqe2P7SX2a3zHDAt919WtpkUMAxzv9eP5uPfVXtpk2Ipms2NXJGY5190aJc1uY+ambfJ3rwDJRA== +"@vitest/browser@^1.5.0": + version "1.5.0" + resolved "https://registry.yarnpkg.com/@vitest/browser/-/browser-1.5.0.tgz#ccf01efde857883b4968bf2478714aec901f88b1" + integrity sha512-tJLV8j8sufAT2a3eONnfgIclaqx4RqC8sA3xH8uXwxFw7CNwWCPeJ0czVkUzCE/15bHRoGxwsHC+Ycch6zDb1Q== dependencies: - "@vitest/utils" "1.4.0" + "@vitest/utils" "1.5.0" magic-string "^0.30.5" sirv "^2.0.4" -"@vitest/coverage-v8@^1.4.0": - version "1.4.0" - resolved "https://registry.yarnpkg.com/@vitest/coverage-v8/-/coverage-v8-1.4.0.tgz#78ba9e182ff4cd1eba79c45cfafd2edc4c2941ec" - integrity sha512-4hDGyH1SvKpgZnIByr9LhGgCEuF9DKM34IBLCC/fVfy24Z3+PZ+Ii9hsVBsHvY1umM1aGPEjceRkzxCfcQ10wg== +"@vitest/coverage-v8@^1.5.0": + version "1.5.0" + resolved "https://registry.yarnpkg.com/@vitest/coverage-v8/-/coverage-v8-1.5.0.tgz#2eb4472b497d820934b1a4e4d387547d3be62ba3" + integrity sha512-1igVwlcqw1QUMdfcMlzzY4coikSIBN944pkueGi0pawrX5I5Z+9hxdTR+w3Sg6Q3eZhvdMAs8ZaF9JuTG1uYOQ== dependencies: "@ampproject/remapping" "^2.2.1" "@bcoe/v8-coverage" "^0.2.3" @@ -3288,7 +3333,6 @@ std-env "^3.5.0" strip-literal "^2.0.0" test-exclude "^6.0.0" - v8-to-istanbul "^9.2.0" "@vitest/expect@1.2.1": version "1.2.1" @@ -3299,13 +3343,13 @@ "@vitest/utils" "1.2.1" chai "^4.3.10" -"@vitest/expect@1.4.0": - version "1.4.0" - resolved "https://registry.yarnpkg.com/@vitest/expect/-/expect-1.4.0.tgz#d64e17838a20007fecd252397f9b96a1ca81bfb0" - integrity sha512-Jths0sWCJZ8BxjKe+p+eKsoqev1/T8lYcrjavEaz8auEJ4jAVY0GwW3JKmdVU4mmNPLPHixh4GNXP7GFtAiDHA== +"@vitest/expect@1.5.0": + version "1.5.0" + resolved "https://registry.yarnpkg.com/@vitest/expect/-/expect-1.5.0.tgz#961190510a2723bd4abf5540bcec0a4dfd59ef14" + integrity sha512-0pzuCI6KYi2SIC3LQezmxujU9RK/vwC1U9R0rLuGlNGcOuDWxqWKu6nUdFsX9tH1WU0SXtAxToOsEjeUn1s3hA== dependencies: - "@vitest/spy" "1.4.0" - "@vitest/utils" "1.4.0" + "@vitest/spy" "1.5.0" + "@vitest/utils" "1.5.0" chai "^4.3.10" "@vitest/runner@1.2.1": @@ -3317,12 +3361,12 @@ p-limit "^5.0.0" pathe "^1.1.1" -"@vitest/runner@1.4.0": - version "1.4.0" - resolved "https://registry.yarnpkg.com/@vitest/runner/-/runner-1.4.0.tgz#907c2d17ad5975b70882c25ab7a13b73e5a28da9" - integrity sha512-EDYVSmesqlQ4RD2VvWo3hQgTJ7ZrFQ2VSJdfiJiArkCerDAGeyF1i6dHkmySqk573jLp6d/cfqCN+7wUB5tLgg== +"@vitest/runner@1.5.0": + version "1.5.0" + resolved "https://registry.yarnpkg.com/@vitest/runner/-/runner-1.5.0.tgz#1f7cb78ee4064e73e53d503a19c1b211c03dfe0c" + integrity sha512-7HWwdxXP5yDoe7DTpbif9l6ZmDwCzcSIK38kTSIt6CFEpMjX4EpCgT6wUmS0xTXqMI6E/ONmfgRKmaujpabjZQ== dependencies: - "@vitest/utils" "1.4.0" + "@vitest/utils" "1.5.0" p-limit "^5.0.0" pathe "^1.1.1" @@ -3335,10 +3379,10 @@ pathe "^1.1.1" pretty-format "^29.7.0" -"@vitest/snapshot@1.4.0": - version "1.4.0" - resolved "https://registry.yarnpkg.com/@vitest/snapshot/-/snapshot-1.4.0.tgz#2945b3fb53767a3f4f421919e93edfef2935b8bd" - integrity sha512-saAFnt5pPIA5qDGxOHxJ/XxhMFKkUSBJmVt5VgDsAqPTX6JP326r5C/c9UuCMPoXNzuudTPsYDZCoJ5ilpqG2A== +"@vitest/snapshot@1.5.0": + version "1.5.0" + resolved "https://registry.yarnpkg.com/@vitest/snapshot/-/snapshot-1.5.0.tgz#cd2d611fd556968ce8fb6b356a09b4593c525947" + integrity sha512-qpv3fSEuNrhAO3FpH6YYRdaECnnRjg9VxbhdtPwPRnzSfHVXnNzzrpX4cJxqiwgRMo7uRMWDFBlsBq4Cr+rO3A== dependencies: magic-string "^0.30.5" pathe "^1.1.1" @@ -3351,10 +3395,10 @@ dependencies: tinyspy "^2.2.0" -"@vitest/spy@1.4.0": - version "1.4.0" - resolved "https://registry.yarnpkg.com/@vitest/spy/-/spy-1.4.0.tgz#cf953c93ae54885e801cbe6b408a547ae613f26c" - integrity sha512-Ywau/Qs1DzM/8Uc+yA77CwSegizMlcgTJuYGAi0jujOteJOUf1ujunHThYo243KG9nAyWT3L9ifPYZ5+As/+6Q== +"@vitest/spy@1.5.0": + version "1.5.0" + resolved "https://registry.yarnpkg.com/@vitest/spy/-/spy-1.5.0.tgz#1369a1bec47f46f18eccfa45f1e8fbb9b5e15e77" + integrity sha512-vu6vi6ew5N5MMHJjD5PoakMRKYdmIrNJmyfkhRpQt5d9Ewhw9nZ5Aqynbi3N61bvk9UvZ5UysMT6ayIrZ8GA9w== dependencies: tinyspy "^2.2.0" @@ -3368,10 +3412,10 @@ loupe "^2.3.7" pretty-format "^29.7.0" -"@vitest/utils@1.4.0": - version "1.4.0" - resolved "https://registry.yarnpkg.com/@vitest/utils/-/utils-1.4.0.tgz#ea6297e0d329f9ff0a106f4e1f6daf3ff6aad3f0" - integrity sha512-mx3Yd1/6e2Vt/PUC98DcqTirtfxUyAZ32uK82r8rZzbtBeBo+nqgnjx/LvqQdWsrvNtm14VmurNgcf4nqY5gJg== +"@vitest/utils@1.5.0": + version "1.5.0" + resolved "https://registry.yarnpkg.com/@vitest/utils/-/utils-1.5.0.tgz#90c9951f4516f6d595da24876b58e615f6c99863" + integrity sha512-BDU0GNL8MWkRkSRdNFvCUCAVOeHaUlVJ9Tx0TYBZyXaaOTmGtUFObzchCivIBrIwKzvZA7A9sCejVhXM2aY98A== dependencies: diff-sequences "^29.6.3" estree-walker "^3.0.3" @@ -5009,11 +5053,6 @@ conventional-recommended-bump@7.0.1: git-semver-tags "^5.0.0" meow "^8.1.2" -convert-source-map@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-2.0.0.tgz#4b560f649fc4e918dd0ab75cf4961e8bc882d82a" - integrity sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg== - cookie@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.6.0.tgz#2798b04b071b0ecbff0dbb62a505a8efa4e19051" @@ -9047,6 +9086,13 @@ minimatch@^8.0.2: dependencies: brace-expansion "^2.0.1" +minimatch@^9.0.4: + version "9.0.4" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.4.tgz#8e49c731d1749cbec05050ee5145147b32496a51" + integrity sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw== + dependencies: + brace-expansion "^2.0.1" + minimist-options@4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/minimist-options/-/minimist-options-4.1.0.tgz#c0655713c53a8a2ebd77ffa247d342c40f010619" @@ -11073,6 +11119,16 @@ roarr@^2.15.3: semver-compare "^1.0.0" sprintf-js "^1.1.2" +rollup-plugin-visualizer@^5.12.0: + version "5.12.0" + resolved "https://registry.yarnpkg.com/rollup-plugin-visualizer/-/rollup-plugin-visualizer-5.12.0.tgz#661542191ce78ee4f378995297260d0c1efb1302" + integrity sha512-8/NU9jXcHRs7Nnj07PF2o4gjxmm9lXIrZ8r175bT9dK8qoLlvKTwRMArRCMgpMGlq8CTLugRvEmyMeMXIU2pNQ== + dependencies: + open "^8.4.0" + picomatch "^2.3.1" + source-map "^0.7.4" + yargs "^17.5.1" + rollup@^4.13.0: version "4.16.1" resolved "https://registry.yarnpkg.com/rollup/-/rollup-4.16.1.tgz#5a60230987fe95ebe68bab517297c116dbb1a88d" @@ -11229,7 +11285,7 @@ semver@7.5.3: dependencies: lru-cache "^6.0.0" -semver@7.6.0: +semver@7.6.0, semver@^7.6.0: version "7.6.0" resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.0.tgz#1a46a4db4bffcccd97b743b5005c8325f23d4e2d" integrity sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg== @@ -11510,6 +11566,11 @@ source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1: resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== +source-map@^0.7.4: + version "0.7.4" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.4.tgz#a9bbe705c9d8846f4e08ff6765acf0f1b0898656" + integrity sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA== + spdx-correct@^3.0.0: version "3.1.1" resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.1.1.tgz#dece81ac9c1e6713e5f7d1b6f17d468fa53d89a9" @@ -11697,7 +11758,16 @@ strict-event-emitter-types@^2.0.0: resolved "https://registry.npmjs.org/strict-event-emitter-types/-/strict-event-emitter-types-2.0.0.tgz" integrity sha512-Nk/brWYpD85WlOgzw5h173aci0Teyv8YdIAEtV+N88nDB0dLlazZyJMIsN6eo1/AR61l+p6CJTG1JIyFaoNEEA== -"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0": + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -12105,10 +12175,10 @@ tinypool@^0.8.1: resolved "https://registry.yarnpkg.com/tinypool/-/tinypool-0.8.1.tgz#b6c4e4972ede3e3e5cda74a3da1679303d386b03" integrity sha512-zBTCK0cCgRROxvs9c0CGK838sPkeokNGdQVUUwHAbynHFlmyJYj825f/oRs528HaIJ97lo0pLIlDUzwN+IorWg== -tinypool@^0.8.2: - version "0.8.2" - resolved "https://registry.yarnpkg.com/tinypool/-/tinypool-0.8.2.tgz#84013b03dc69dacb322563a475d4c0a9be00f82a" - integrity sha512-SUszKYe5wgsxnNOVlBYO6IC+8VGWdVGZWAqUxp3UErNBtptZvWbwyUOyzNL59zigz2rCA92QiL3wvG+JDSdJdQ== +tinypool@^0.8.3: + version "0.8.4" + resolved "https://registry.yarnpkg.com/tinypool/-/tinypool-0.8.4.tgz#e217fe1270d941b39e98c625dcecebb1408c9aa8" + integrity sha512-i11VH5gS6IFeLY3gMBQ00/MmLncVP7JLXOw1vlgkytLmJK7QnEr7NXf0LBdxfmNPAeyetukOk0bOYrJrFGjYJQ== tinyspy@^2.2.0: version "2.2.0" @@ -12212,6 +12282,11 @@ ts-api-utils@^1.0.1: resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.0.1.tgz#8144e811d44c749cd65b2da305a032510774452d" integrity sha512-lC/RGlPmwdrIBFTX59wwNzqh7aR2otPNPR/5brHZm/XKFYKsfqxihXUe9pU3JI+3vGkl+vyCoNNnPhJn3aLK1A== +ts-api-utils@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.3.0.tgz#4b490e27129f1e8e686b45cc4ab63714dc60eea1" + integrity sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ== + ts-node@^10.8.1: version "10.9.1" resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.1.tgz#e73de9102958af9e1f0b168a6ff320e25adcff4b" @@ -12679,15 +12754,6 @@ v8-compile-cache@2.3.0: resolved "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz" integrity sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA== -v8-to-istanbul@^9.2.0: - version "9.2.0" - resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-9.2.0.tgz#2ed7644a245cddd83d4e087b9b33b3e62dfd10ad" - integrity sha512-/EH/sDgxU2eGxajKdwLCDmQ4FWq+kpi3uCmBGpw1xJtnAxEjlD8j8PEiGWpCIMIs3ciNAgH0d3TTJiUkYzyZjA== - dependencies: - "@jridgewell/trace-mapping" "^0.3.12" - "@types/istanbul-lib-coverage" "^2.0.1" - convert-source-map "^2.0.0" - validate-npm-package-license@3.0.4, validate-npm-package-license@^3.0.1, validate-npm-package-license@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" @@ -12721,10 +12787,10 @@ vite-node@1.2.1: picocolors "^1.0.0" vite "^5.0.0" -vite-node@1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/vite-node/-/vite-node-1.4.0.tgz#265529d60570ca695ceb69391f87f92847934ad8" - integrity sha512-VZDAseqjrHgNd4Kh8icYHWzTKSCZMhia7GyHfhtzLW33fZlG9SwsB6CEhgyVOWkJfJ2pFLrp/Gj1FSfAiqH9Lw== +vite-node@1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/vite-node/-/vite-node-1.5.0.tgz#7f74dadfecb15bca016c5ce5ef85e5cc4b82abf2" + integrity sha512-tV8h6gMj6vPzVCa7l+VGq9lwoJjW8Y79vst8QZZGiuRAfijU+EEWuc0kFpmndQrWhMMhet1jdSF+40KSZUqIIw== dependencies: cac "^6.7.14" debug "^4.3.4" @@ -12749,10 +12815,10 @@ vite-plugin-top-level-await@^1.4.1: "@swc/core" "^1.3.100" uuid "^9.0.1" -vite@^5.0.0: - version "5.2.10" - resolved "https://registry.yarnpkg.com/vite/-/vite-5.2.10.tgz#2ac927c91e99d51b376a5c73c0e4b059705f5bd7" - integrity sha512-PAzgUZbP7msvQvqdSD+ErD5qGnSFiGOoWmV5yAKUEI0kdhjbH6nMWVyZQC/hSc4aXwc0oJ9aEdIiF9Oje0JFCw== +vite@^5.0.0, vite@^5.2.9: + version "5.2.9" + resolved "https://registry.yarnpkg.com/vite/-/vite-5.2.9.tgz#cd9a356c6ff5f7456c09c5ce74068ffa8df743d9" + integrity sha512-uOQWfuZBlc6Y3W/DTuQ1Sr+oIXWvqljLvS881SVmAj00d5RdgShLcuXWxseWPd4HXwiYBFW/vXHfKFeqj9uQnw== dependencies: esbuild "^0.20.1" postcss "^8.4.38" @@ -12792,16 +12858,16 @@ vitest@^1.2.1: vite-node "1.2.1" why-is-node-running "^2.2.2" -vitest@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/vitest/-/vitest-1.4.0.tgz#f5c812aaf5023818b89b7fc667fa45327396fece" - integrity sha512-gujzn0g7fmwf83/WzrDTnncZt2UiXP41mHuFYFrdwaLRVQ6JYQEiME2IfEjU3vcFL3VKa75XhI3lFgn+hfVsQw== - dependencies: - "@vitest/expect" "1.4.0" - "@vitest/runner" "1.4.0" - "@vitest/snapshot" "1.4.0" - "@vitest/spy" "1.4.0" - "@vitest/utils" "1.4.0" +vitest@^1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/vitest/-/vitest-1.5.0.tgz#6ebb396bd358650011a9c96c18fa614b668365c1" + integrity sha512-d8UKgR0m2kjdxDWX6911uwxout6GHS0XaGH1cksSIVVG8kRlE7G7aBw7myKQCvDI5dT4j7ZMa+l706BIORMDLw== + dependencies: + "@vitest/expect" "1.5.0" + "@vitest/runner" "1.5.0" + "@vitest/snapshot" "1.5.0" + "@vitest/spy" "1.5.0" + "@vitest/utils" "1.5.0" acorn-walk "^8.3.2" chai "^4.3.10" debug "^4.3.4" @@ -12813,9 +12879,9 @@ vitest@^1.4.0: std-env "^3.5.0" strip-literal "^2.0.0" tinybench "^2.5.1" - tinypool "^0.8.2" + tinypool "^0.8.3" vite "^5.0.0" - vite-node "1.4.0" + vite-node "1.5.0" why-is-node-running "^2.2.2" vm-browserify@^1.0.1: @@ -13301,7 +13367,16 @@ workerpool@6.2.1: resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.2.1.tgz#46fc150c17d826b86a008e5a4508656777e9c343" integrity sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw== -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + +wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==