diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 2de279cc8..05cc6b9be 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -140,6 +140,8 @@ steps: - HUSKY=0 yarn install --immutable - echo "--- Build bundles" - yarn turbo run --filter='./packages/signals/*' build + - echo "--- Assert Workerbox Up-to-Date" + - yarn workspace @segment/analytics-signals run assert-workerbox-built - echo "+++ Run Lint" - yarn turbo run --filter='./packages/signals/*' lint - echo "+++ Run Tests" diff --git a/.changeset/nasty-drinks-nail.md b/.changeset/nasty-drinks-nail.md new file mode 100644 index 000000000..49a80ad41 --- /dev/null +++ b/.changeset/nasty-drinks-nail.md @@ -0,0 +1,5 @@ +--- +'@segment/analytics-signals': minor +--- + +- Fix npm installation esm error by vendoring esm-only module workerbox diff --git a/.gitignore b/.gitignore index fcc1dfec8..e7f5a7643 100644 --- a/.gitignore +++ b/.gitignore @@ -31,7 +31,7 @@ reports/* .changelog .turbo -/test-results/ +test-results/ playwright-report/ playwright/.cache/ tmp.tsconfig.json diff --git a/packages/signals/signals-integration-tests/playwright.config.ts b/packages/signals/signals-integration-tests/playwright.config.ts index 04196bddb..fe45d2455 100644 --- a/packages/signals/signals-integration-tests/playwright.config.ts +++ b/packages/signals/signals-integration-tests/playwright.config.ts @@ -34,10 +34,8 @@ const config: PlaywrightTestConfig = { reporter: 'html', /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ use: { - /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ - actionTimeout: 0, /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ - trace: 'on-first-retry', + trace: 'on', }, /* Configure projects for major browsers */ diff --git a/packages/signals/signals-integration-tests/src/helpers/base-page-object.ts b/packages/signals/signals-integration-tests/src/helpers/base-page-object.ts index 5190a1e6c..b3fd9522c 100644 --- a/packages/signals/signals-integration-tests/src/helpers/base-page-object.ts +++ b/packages/signals/signals-integration-tests/src/helpers/base-page-object.ts @@ -231,9 +231,7 @@ export class BasePage { }, body: JSON.stringify({ foo: 'bar' }), ...request, - }) - .then(console.log) - .catch(console.error) + }).catch(console.error) }, { url, request } ) diff --git a/packages/signals/signals-integration-tests/src/helpers/log-console.ts b/packages/signals/signals-integration-tests/src/helpers/log-console.ts index 2da24ba80..4bf806569 100644 --- a/packages/signals/signals-integration-tests/src/helpers/log-console.ts +++ b/packages/signals/signals-integration-tests/src/helpers/log-console.ts @@ -2,6 +2,9 @@ import { Page } from '@playwright/test' export const logConsole = (page: Page) => { page.on('console', (msg) => { - console.log(`[${msg.type()}]`, msg.text()) + console.log(`console.${msg.type()}:`, msg.text()) + }) + page.on('pageerror', (error) => { + console.error('Page error:', error) }) } diff --git a/packages/signals/signals/.lintstagedrc.js b/packages/signals/signals/.lintstagedrc.js index bc1f1c780..7fa7ceee1 100644 --- a/packages/signals/signals/.lintstagedrc.js +++ b/packages/signals/signals/.lintstagedrc.js @@ -1 +1,5 @@ -module.exports = require("@internal/config").lintStagedConfig +module.exports = { + ...require("@internal/config").lintStagedConfig, + 'src/lib/workerbox/*.{js,ts,html}': ['yarn workerbox'] +} + diff --git a/packages/signals/signals/package.json b/packages/signals/signals/package.json index 9aa8f770a..389dc61b6 100644 --- a/packages/signals/signals/package.json +++ b/packages/signals/signals/package.json @@ -32,6 +32,8 @@ "build:cjs": "yarn tsc -p tsconfig.build.json --outDir ./dist/cjs --module commonjs", "build:bundle": "NODE_ENV=production yarn run webpack", "build:bundle-dev": "NODE_ENV=development yarn run webpack", + "workerbox": "node scripts/build-workerbox.js", + "assert-workerbox-built": "sh scripts/assert-workerbox-built.sh", "watch": "yarn concurrently 'yarn build:bundle-dev --watch' 'yarn build:esm --watch'", "version": "sh scripts/version.sh", "watch:test": "yarn test --watch", @@ -44,8 +46,7 @@ "dependencies": { "@segment/analytics-generic-utils": "1.2.0", "idb": "^8.0.0", - "tslib": "^2.4.1", - "workerboxjs": "^6.1.1" + "tslib": "^2.4.1" }, "peerDependencies": { "@segment/analytics-next": ">1.72.0" @@ -60,6 +61,7 @@ "@internal/config-webpack": "workspace:^", "@internal/test-helpers": "workspace:^", "fake-indexeddb": "^6.0.0", + "minify": "^11.4.1", "node-fetch": "^2.6.7" } } diff --git a/packages/signals/signals/scripts/assert-workerbox-built.sh b/packages/signals/signals/scripts/assert-workerbox-built.sh new file mode 100644 index 000000000..d5550d409 --- /dev/null +++ b/packages/signals/signals/scripts/assert-workerbox-built.sh @@ -0,0 +1,16 @@ +#!/bin/sh +# A CI script to ensure people remember to rebuild workerbox related files if workerbox changes + +node scripts/build-workerbox.js +# Check for changes in the workerbox directory +changed_files=$(git diff --name-only | grep 'lib/workerbox') + +# Check for changes in the workerbox directory +if [ -n "$changed_files" ]; then + echo "Error: Changes detected in the workerbox directory. Please commit the changed files:" + echo "$changed_files" + exit 1 +else + echo "Files have not changed" + exit 0 +fi \ No newline at end of file diff --git a/packages/signals/signals/scripts/build-workerbox.js b/packages/signals/signals/scripts/build-workerbox.js new file mode 100644 index 000000000..d1bc1da3b --- /dev/null +++ b/packages/signals/signals/scripts/build-workerbox.js @@ -0,0 +1,64 @@ +const fs = require('fs') +const esbuild = require('esbuild') +const path = require('path') + +// Note: This was adopted from the https://github.com/markwylde/workerbox/blob/master/build.js +console.log('Building workerbox...') + +const DEBUG = process.env.DEBUG === 'true' +if (DEBUG) console.log('Minification off.') + +async function writeFileWithDirs(filePath, data) { + // Extract the directory path from the file path + const dir = path.dirname(filePath) + + // Ensure the directory exists + await fs.promises.mkdir(dir, { recursive: true }) + + // Write the file + await fs.promises.writeFile(filePath, data, 'utf8') +} + +async function build() { + console.log(new Date(), 'rebuilding...') + + // clean up dist folder + await fs.promises.rm('./src/lib/workerbox/dist', { + recursive: true, + force: true, + }) + + await esbuild.build({ + entryPoints: ['./src/lib/workerbox/worker.ts'], + bundle: true, + outfile: './src/lib/workerbox/dist/worker.js', + minify: !DEBUG, + }) + + const jsData = await fs.promises.readFile( + './src/lib/workerbox/dist/worker.js', + 'utf8' + ) + + const TEMPLATE_PLACEHOLDER = `{{WORKERSCRIPT}}` + const htmlData = ( + await fs.promises.readFile('./src/lib/workerbox/worker.html', 'utf8') + ).replace(TEMPLATE_PLACEHOLDER, jsData) + + await writeFileWithDirs('./src/lib/workerbox/dist/worker.html', htmlData) + await writeFileWithDirs( + './src/lib/workerbox/worker.generated.ts', + [ + '/* eslint-disable */', + `// built from /dist/worker.html`, + `export default atob('${Buffer.from(htmlData).toString('base64')}');`, + ].join('\n') + ) +} + +build() + .then(() => console.log('Build successful')) + .catch((err) => { + console.error(err) + process.exit(1) + }) diff --git a/packages/signals/signals/src/core/processor/sandbox.ts b/packages/signals/signals/src/core/processor/sandbox.ts index 3e497e910..ee985fa93 100644 --- a/packages/signals/signals/src/core/processor/sandbox.ts +++ b/packages/signals/signals/src/core/processor/sandbox.ts @@ -1,5 +1,5 @@ import { logger } from '../../lib/logger' -import createWorkerBox from 'workerboxjs' +import { createWorkerBox, WorkerBoxAPI } from '../../lib/workerbox' import { resolvers } from './arg-resolvers' import { AnalyticsRuntimePublicApi, Signal, AnalyticsEnums } from '../../types' import { createSignalsRuntime } from './signals-runtime' @@ -121,9 +121,9 @@ interface CodeSandbox { } class JavascriptSandbox implements CodeSandbox { - private workerbox: Promise + private workerbox: Promise constructor() { - this.workerbox = createWorkerBox('') + this.workerbox = createWorkerBox() } async run(fn: string, scope: Record) { try { diff --git a/packages/signals/signals/__mocks__/workerboxjs.ts b/packages/signals/signals/src/lib/workerbox/__mocks__/workerbox.ts similarity index 88% rename from packages/signals/signals/__mocks__/workerboxjs.ts rename to packages/signals/signals/src/lib/workerbox/__mocks__/workerbox.ts index 862930df8..04a9585fc 100644 --- a/packages/signals/signals/__mocks__/workerboxjs.ts +++ b/packages/signals/signals/src/lib/workerbox/__mocks__/workerbox.ts @@ -10,4 +10,4 @@ const createWorkerBox = jest.fn(() => { }) }) -export default createWorkerBox +export { createWorkerBox } diff --git a/packages/signals/signals/src/lib/workerbox/index.ts b/packages/signals/signals/src/lib/workerbox/index.ts new file mode 100644 index 000000000..ec1d9742e --- /dev/null +++ b/packages/signals/signals/src/lib/workerbox/index.ts @@ -0,0 +1,251 @@ +/** + * Copyright 2022 Mark Wylde + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + */ + +import { default as worker } from './worker.generated' + +/** + * Whenever this script is modified, we need to run `yarn workerbox` and commit the result. + * This happens via lint-staged (on commit that modifiies the enclosing folder), so it should be automatic. + */ +export function stringToScope( + object: any, + addCallback: Function, + runCallback: Function +) { + return decodeArg(JSON.parse(object), addCallback, runCallback) +} + +// This was modified nd adopted from ^ workerbox library - https://github.com/markwylde/workerbox/blob/master/lib/index.js +// note: we could write our own, but this has always been tested and works +// the types are bad because the workerbox library src is not typed, and I did not want to spend a lot of time writing types. +const generateUniqueId = () => { + // @ts-ignore + globalThis.workerboxIncrementor = (globalThis.workerboxIncrementor || 0) + 1 + return ( + // @ts-ignore + globalThis.workerboxIncrementor + + '_' + + Array(20) + .fill( + '!@#$%^&*()_+-=0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' + ) + .map((x) => { + return x[Math.floor(Math.random() * x.length)] + }) + .join('') + ) +} + +export function createCallbackStore() { + const store: Record = {} + const add = (fn: Function) => { + const id = generateUniqueId() + store[id] = fn + return id + } + const get = (id: string) => { + return store[id] + } + return { + store, + add, + get, + } +} + +function encodeArg( + arg: any, + addCallback: Function, + runCallback: Function +): ['callback' | 'object' | 'literal' | 'array', any] { + if (typeof arg === 'function') { + return ['callback', addCallback(arg)] + } else if (arg instanceof Array) { + return [ + 'array', + arg.map((arg2) => encodeArg(arg2, addCallback, runCallback)), + ] + } else if (typeof arg === 'object' && arg !== null) { + const newArg: Record = {} + for (const key in arg) { + newArg[key] = encodeArg(arg[key], addCallback, runCallback) + } + return ['object', newArg] + } else { + return ['literal', arg] + } +} + +export function scopeToString( + scope: any, + addCallback: Function, + runCallback: Function +) { + return JSON.stringify(encodeArg(scope || {}, addCallback, runCallback)) +} + +export function argsToString( + args: any, + addCallback: Function, + runCallback: Function +): string { + return JSON.stringify(encodeArg(args, addCallback, runCallback)) +} + +function decodeArg(arg: any, addCallback: Function, runCallback: Function) { + if (arg[0] === 'callback') { + return (...args: any[]) => + runCallback(arg[1], argsToString(args, addCallback, runCallback)) + } else if (arg[0] === 'array') { + return arg[1].map((arg: any) => decodeArg(arg, addCallback, runCallback)) + } else if (arg[0] === 'object') { + const decodedArg: Record = {} + for (const key in arg[1]) { + decodedArg[key] = decodeArg(arg[1][key], addCallback, runCallback) + } + return decodedArg + } else if (arg[0] === 'literal') { + return arg[1] + } else { + throw Error(`Unexpected arg type: ${arg[0]}`) + } +} + +export function stringToArgs( + args: any, + addCallback: Function, + runCallback: Function +) { + return decodeArg(JSON.parse(args), addCallback, runCallback) +} + +const instances = { + count: 0, +} +export function createWorkerboxInstance( + url: string | undefined, + onMessage: MessagePort['onmessage'] +) { + instances.count = instances.count + 1 + const channel = new MessageChannel() + const iframe = document.createElement('iframe') + iframe.setAttribute('sandbox', 'allow-scripts') + iframe.id = `seg-workerbox-${instances.count}` + + // display none is not enough + iframe.setAttribute( + 'style', + 'position: fixed; height: 0; width: 0; opacity: 0; top: -100px;' + ) + if (url) { + iframe.src = url + } else { + iframe.srcdoc = worker.toString() + } + document.body.appendChild(iframe) + channel.port1.onmessage = onMessage + return new Promise<{ + postMessage: (message: any) => void + destroy: () => void + }>((resolve) => { + iframe.addEventListener('load', () => { + if (!iframe.contentWindow) { + throw new Error('iframe.contentWindow is null') + } + iframe.contentWindow.postMessage('OK', '*', [channel.port2]) + resolve({ + postMessage: (message) => channel.port1.postMessage(message), + destroy: () => iframe.remove(), + }) + }) + }) +} + +export interface WorkerBoxOptions { + url?: string +} + +export interface WorkerBoxAPI { + run: (code: string, scope: Record) => Promise + destroy: () => void + opts?: WorkerBoxOptions +} + +async function createWorkerBox( + opts: WorkerBoxOptions = {} +): Promise { + if (opts.url && opts.url.slice(-1) === '/') { + opts.url = opts.url.slice(0, -1) + } + + opts.url = opts.url && new URL(opts.url).href + const callbacks = createCallbackStore() + const run = (id: string, args: any) => + new Promise((resolve, reject) => { + instance.postMessage([ + 'callback', + { + id, + args, + resolve: callbacks.add(resolve), + reject: callbacks.add(reject), + }, + ]) + }) + const instance = await createWorkerboxInstance(opts.url, async (message) => { + const [action, { id, args, resolve, reject }] = message.data + const parsedArgs = stringToArgs(args, callbacks.add, run) + if (action === 'error') { + callbacks.get(id)?.(new Error(parsedArgs[0])) + return + } + if (action === 'return') { + callbacks.get(id)?.(parsedArgs[0]) + return + } + const fn = callbacks.get(id) + if (!fn) { + return + } + try { + const result = await fn(...parsedArgs) + instance.postMessage([ + 'callback', + { + id: resolve, + args: argsToString([result], callbacks.add, run), + }, + ]) + } catch (error) { + const message = error instanceof Error ? error.message : error + instance.postMessage([ + 'callback', + { + id: reject, + args: argsToString([message], callbacks.add, run), + }, + ]) + } + }) + return { + run: async (code, originalScope) => { + return new Promise((resolve, reject) => { + const id = callbacks.add(resolve) + const errorId = callbacks.add(reject) + const scope = scopeToString(originalScope, callbacks.add, run) + instance.postMessage(['execute', { id, errorId, code, scope }]) + }) + }, + destroy: () => instance.destroy(), + opts, + } +} + +export { createWorkerBox } diff --git a/packages/signals/signals/src/lib/workerbox/worker.generated.ts b/packages/signals/signals/src/lib/workerbox/worker.generated.ts new file mode 100644 index 000000000..232281d65 --- /dev/null +++ b/packages/signals/signals/src/lib/workerbox/worker.generated.ts @@ -0,0 +1,3 @@ +/* eslint-disable */ +// built from /dist/worker.html +export default atob('PHNjcmlwdD4KICBmdW5jdGlvbiB3b3JrZXJTY3JpcHQoKSB7CiAgICAidXNlIHN0cmljdCI7KCgpPT57ZnVuY3Rpb24gYihlLHIsdCl7cmV0dXJuIHAoSlNPTi5wYXJzZShlKSxyLHQpfXZhciBTPSgpPT4oZ2xvYmFsVGhpcy53b3JrZXJib3hJbmNyZW1lbnRvcj0oZ2xvYmFsVGhpcy53b3JrZXJib3hJbmNyZW1lbnRvcnx8MCkrMSxnbG9iYWxUaGlzLndvcmtlcmJveEluY3JlbWVudG9yKyJfIitBcnJheSgyMCkuZmlsbCgiIUAjJCVeJiooKV8rLT0wMTIzNDU2Nzg5QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5eiIpLm1hcChlPT5lW01hdGguZmxvb3IoTWF0aC5yYW5kb20oKSplLmxlbmd0aCldKS5qb2luKCIiKSk7ZnVuY3Rpb24geCgpe2xldCBlPXt9O3JldHVybntzdG9yZTplLGFkZDpuPT57bGV0IG89UygpO3JldHVybiBlW29dPW4sb30sZ2V0Om49PmVbbl19fWZ1bmN0aW9uIG0oZSxyLHQpe2lmKHR5cGVvZiBlPT0iZnVuY3Rpb24iKXJldHVyblsiY2FsbGJhY2siLHIoZSldO2lmKGUgaW5zdGFuY2VvZiBBcnJheSlyZXR1cm5bImFycmF5IixlLm1hcChuPT5tKG4scix0KSldO2lmKHR5cGVvZiBlPT0ib2JqZWN0IiYmZSE9PW51bGwpe2xldCBuPXt9O2ZvcihsZXQgbyBpbiBlKW5bb109bShlW29dLHIsdCk7cmV0dXJuWyJvYmplY3QiLG5dfWVsc2UgcmV0dXJuWyJsaXRlcmFsIixlXX1mdW5jdGlvbiBhKGUscix0KXtyZXR1cm4gSlNPTi5zdHJpbmdpZnkobShlLHIsdCkpfWZ1bmN0aW9uIHAoZSxyLHQpe2lmKGVbMF09PT0iY2FsbGJhY2siKXJldHVybiguLi5uKT0+dChlWzFdLGEobixyLHQpKTtpZihlWzBdPT09ImFycmF5IilyZXR1cm4gZVsxXS5tYXAobj0+cChuLHIsdCkpO2lmKGVbMF09PT0ib2JqZWN0Iil7bGV0IG49e307Zm9yKGxldCBvIGluIGVbMV0pbltvXT1wKGVbMV1bb10scix0KTtyZXR1cm4gbn1lbHNle2lmKGVbMF09PT0ibGl0ZXJhbCIpcmV0dXJuIGVbMV07dGhyb3cgRXJyb3IoYFVuZXhwZWN0ZWQgYXJnIHR5cGU6ICR7ZVswXX1gKX19ZnVuY3Rpb24gayhlLHIsdCl7cmV0dXJuIHAoSlNPTi5wYXJzZShlKSxyLHQpfWFzeW5jIGZ1bmN0aW9uIEUoZSxyKXtyZXR1cm4gYXdhaXQgRnVuY3Rpb24uYXBwbHkobnVsbCxbLi4uT2JqZWN0LmtleXMoZSksYHJldHVybiAoYXN5bmMgZnVuY3Rpb24gc2FuZGJveCAoKSB7JHtyfSB9KSgpYF0pLmFwcGx5KG51bGwsWy4uLk9iamVjdC52YWx1ZXMoZSldKX12YXIgdz0oZSxyKT0+e2lmKCFlLnN0YWNrKXJldHVybiBlLm1lc3NhZ2U7bGV0IHQ9ZS5zdGFjay5zcGxpdChgCmApLG49cz0+dHlwZW9mIHM9PSJzdHJpbmciP3BhcnNlSW50KHMsMTApOnM7cmV0dXJuW3RbMF0sLi4udC5maWx0ZXIocz0+cy5pbmNsdWRlcygiKGV2YWwgYXQgc2NvcGVkRXZhbCIpKS5tYXAocz0+e2xldCBkPXMuc3BsaXQoIihldmFsIGF0IHNjb3BlZEV2YWwgKCIpLFssbF09cy5zcGxpdCgiPGFub255bW91cz4iKSxbLGcsZl09bC5zbGljZSgwLC0xKS5zcGxpdCgiOiIpO3JldHVybmAke2RbMF19KDxzYW5kYm94Pjoke24oZyktM306JHtmfSlgfSldLnNsaWNlKDAscikuam9pbihgCmApfTtzZWxmLmFkZEV2ZW50TGlzdGVuZXIoIm1lc3NhZ2UiLGU9PntsZXQgcj1lLnBvcnRzWzBdLHQ9eCgpLG49KG8scyk9Pm5ldyBQcm9taXNlKGQ9PntyLnBvc3RNZXNzYWdlKFsiY2FsbGJhY2siLHtpZDpvLGFyZ3M6cyxyZXNvbHZlOnQuYWRkKGQpfV0pfSk7ci5vbm1lc3NhZ2U9YXN5bmMgbz0+e2xldFtzLGRdPW8uZGF0YSx7aWQ6bCxlcnJvcklkOmcsY29kZTpmLHNjb3BlOmgsYXJnczp2LHJlc29sdmU6TSxyZWplY3Q6Rn09ZDtpZihzPT09ImV4ZWN1dGUiKXtsZXQgeT1iKGgsdC5hZGQsbik7dHJ5e2xldCBpPWF3YWl0IEUoeSxmKTtyLnBvc3RNZXNzYWdlKFsicmV0dXJuIix7aWQ6bCxhcmdzOmEoW2ldLHQuYWRkLG4pfV0pfWNhdGNoKGkpe2xldCBjPWk7dHJ5e2xldCB1PXcoYywtMSk7ci5wb3N0TWVzc2FnZShbImVycm9yIix7aWQ6ZyxhcmdzOmEoW3V8fGMubWVzc2FnZV0sdC5hZGQsbil9XSl9Y2F0Y2h7ci5wb3N0TWVzc2FnZShbImVycm9yIix7aWQ6ZyxhcmdzOmEoW2MubWVzc2FnZV0sdC5hZGQsbil9XSl9fX1pZihzPT09ImNhbGxiYWNrIil7bGV0IHk9ayh2LHQuYWRkLG4pLGk9dC5nZXQobCk7aWYoIWkpcmV0dXJuO3RyeXtsZXQgYz1hd2FpdCBpKC4uLnkpO3IucG9zdE1lc3NhZ2UoWyJyZXR1cm4iLHtpZDpNLGFyZ3M6YShbY10sdC5hZGQsbil9XSl9Y2F0Y2goYyl7bGV0IHU9YyxBPXcodSk7ci5wb3N0TWVzc2FnZShbImVycm9yIix7aWQ6RixhcmdzOmEoW0F8fHUubWVzc2FnZV0sdC5hZGQsbil9XSl9fX19KTt9KSgpOwoKICB9CgogIHNlbGYuYWRkRXZlbnRMaXN0ZW5lcignbWVzc2FnZScsIGFzeW5jIChldmVudCkgPT4gewogICAgY29uc3QgY29kZSA9IHdvcmtlclNjcmlwdC50b1N0cmluZygpLnNwbGl0KCdcbicpLnNsaWNlKDEsIC0xKS5qb2luKCdcbicpOwogICAgY29uc3QgYmxvYiA9IG5ldyBCbG9iKFtjb2RlXSwgeyB0eXBlOiAnYXBwbGljYXRpb24vamF2YXNjcmlwdCcgfSkKICAgIGNvbnN0IHdvcmtlciA9IG5ldyBXb3JrZXIoVVJMLmNyZWF0ZU9iamVjdFVSTChibG9iKSkKCiAgICB3b3JrZXIucG9zdE1lc3NhZ2UoJ09LJywgZXZlbnQucG9ydHMpOwogIH0pOwo8L3NjcmlwdD4='); \ No newline at end of file diff --git a/packages/signals/signals/src/lib/workerbox/worker.html b/packages/signals/signals/src/lib/workerbox/worker.html new file mode 100644 index 000000000..a5808c204 --- /dev/null +++ b/packages/signals/signals/src/lib/workerbox/worker.html @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/packages/signals/signals/src/lib/workerbox/worker.ts b/packages/signals/signals/src/lib/workerbox/worker.ts new file mode 100644 index 000000000..74cdba8ef --- /dev/null +++ b/packages/signals/signals/src/lib/workerbox/worker.ts @@ -0,0 +1,115 @@ +import { + createCallbackStore, + argsToString, + stringToScope, + stringToArgs, +} from './index' +async function scopedEval(context: any, expr: string) { + const evaluator = Function.apply(null, [ + ...Object.keys(context), + `return (async function sandbox () {${expr} })()`, + ]) + return await evaluator.apply(null, [...Object.values(context)]) +} + +const getStack = (error: Error, slice?: number) => { + if (!error.stack) { + return error.message + } + const lines: string[] = error.stack.split('\n') + const parseNumber = (num: string | number) => + typeof num === 'string' ? parseInt(num, 10) : num + const stack = [ + lines[0], + ...lines + .filter((line) => line.includes('(eval at scopedEval')) + .map((line) => { + const splitted = line.split('(eval at scopedEval (') + const [, mixedPosition] = line.split('') + const [, lineNumber, charNumber] = mixedPosition.slice(0, -1).split(':') + return `${splitted[0]}(:${ + parseNumber(lineNumber) - 3 + }:${charNumber})` + }), + ] + .slice(0, slice) + .join('\n') + return stack +} + +self.addEventListener('message', (event) => { + const port = event.ports[0] + + const callbacks = createCallbackStore() + const run = (id: string, args: any) => + new Promise((resolve) => { + port.postMessage([ + 'callback', + { id, args, resolve: callbacks.add(resolve) }, + ]) + }) + + port.onmessage = async (event) => { + const [action, message] = event.data + const { id, errorId, code, scope, args, resolve, reject } = message + + if (action === 'execute') { + const parsedScope = stringToScope(scope, callbacks.add, run) + + try { + const result = await scopedEval(parsedScope, code) + + port.postMessage([ + 'return', + { id, args: argsToString([result], callbacks.add, run) }, + ]) + } catch (e) { + const error = e as Error + try { + const stack = getStack(error, -1) + port.postMessage([ + 'error', + { + id: errorId, + args: argsToString([stack || error.message], callbacks.add, run), + }, + ]) + } catch (error2) { + port.postMessage([ + 'error', + { + id: errorId, + args: argsToString([error.message], callbacks.add, run), + }, + ]) + } + } + } + + if (action === 'callback') { + const parsedArgs = stringToArgs(args, callbacks.add, run) + + const fn = callbacks.get(id) + if (!fn) { + return + } + try { + const result = await fn(...parsedArgs) + port.postMessage([ + 'return', + { id: resolve, args: argsToString([result], callbacks.add, run) }, + ]) + } catch (e) { + const error = e as Error + const stack = getStack(error) + port.postMessage([ + 'error', + { + id: reject, + args: argsToString([stack || error.message], callbacks.add, run), + }, + ]) + } + } + } +}) diff --git a/yarn.lock b/yarn.lock index 4e1c5a039..39b8a93fd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2653,6 +2653,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/aix-ppc64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/aix-ppc64@npm:0.23.1" + conditions: os=aix & cpu=ppc64 + languageName: node + linkType: hard + "@esbuild/android-arm64@npm:0.17.19": version: 0.17.19 resolution: "@esbuild/android-arm64@npm:0.17.19" @@ -2660,6 +2667,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/android-arm64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/android-arm64@npm:0.23.1" + conditions: os=android & cpu=arm64 + languageName: node + linkType: hard + "@esbuild/android-arm@npm:0.17.19": version: 0.17.19 resolution: "@esbuild/android-arm@npm:0.17.19" @@ -2667,6 +2681,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/android-arm@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/android-arm@npm:0.23.1" + conditions: os=android & cpu=arm + languageName: node + linkType: hard + "@esbuild/android-x64@npm:0.17.19": version: 0.17.19 resolution: "@esbuild/android-x64@npm:0.17.19" @@ -2674,6 +2695,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/android-x64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/android-x64@npm:0.23.1" + conditions: os=android & cpu=x64 + languageName: node + linkType: hard + "@esbuild/darwin-arm64@npm:0.17.19": version: 0.17.19 resolution: "@esbuild/darwin-arm64@npm:0.17.19" @@ -2681,6 +2709,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/darwin-arm64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/darwin-arm64@npm:0.23.1" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + "@esbuild/darwin-x64@npm:0.17.19": version: 0.17.19 resolution: "@esbuild/darwin-x64@npm:0.17.19" @@ -2688,6 +2723,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/darwin-x64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/darwin-x64@npm:0.23.1" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + "@esbuild/freebsd-arm64@npm:0.17.19": version: 0.17.19 resolution: "@esbuild/freebsd-arm64@npm:0.17.19" @@ -2695,6 +2737,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/freebsd-arm64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/freebsd-arm64@npm:0.23.1" + conditions: os=freebsd & cpu=arm64 + languageName: node + linkType: hard + "@esbuild/freebsd-x64@npm:0.17.19": version: 0.17.19 resolution: "@esbuild/freebsd-x64@npm:0.17.19" @@ -2702,6 +2751,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/freebsd-x64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/freebsd-x64@npm:0.23.1" + conditions: os=freebsd & cpu=x64 + languageName: node + linkType: hard + "@esbuild/linux-arm64@npm:0.17.19": version: 0.17.19 resolution: "@esbuild/linux-arm64@npm:0.17.19" @@ -2709,6 +2765,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-arm64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/linux-arm64@npm:0.23.1" + conditions: os=linux & cpu=arm64 + languageName: node + linkType: hard + "@esbuild/linux-arm@npm:0.17.19": version: 0.17.19 resolution: "@esbuild/linux-arm@npm:0.17.19" @@ -2716,6 +2779,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-arm@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/linux-arm@npm:0.23.1" + conditions: os=linux & cpu=arm + languageName: node + linkType: hard + "@esbuild/linux-ia32@npm:0.17.19": version: 0.17.19 resolution: "@esbuild/linux-ia32@npm:0.17.19" @@ -2723,6 +2793,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-ia32@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/linux-ia32@npm:0.23.1" + conditions: os=linux & cpu=ia32 + languageName: node + linkType: hard + "@esbuild/linux-loong64@npm:0.14.54": version: 0.14.54 resolution: "@esbuild/linux-loong64@npm:0.14.54" @@ -2737,6 +2814,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-loong64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/linux-loong64@npm:0.23.1" + conditions: os=linux & cpu=loong64 + languageName: node + linkType: hard + "@esbuild/linux-mips64el@npm:0.17.19": version: 0.17.19 resolution: "@esbuild/linux-mips64el@npm:0.17.19" @@ -2744,6 +2828,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-mips64el@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/linux-mips64el@npm:0.23.1" + conditions: os=linux & cpu=mips64el + languageName: node + linkType: hard + "@esbuild/linux-ppc64@npm:0.17.19": version: 0.17.19 resolution: "@esbuild/linux-ppc64@npm:0.17.19" @@ -2751,6 +2842,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-ppc64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/linux-ppc64@npm:0.23.1" + conditions: os=linux & cpu=ppc64 + languageName: node + linkType: hard + "@esbuild/linux-riscv64@npm:0.17.19": version: 0.17.19 resolution: "@esbuild/linux-riscv64@npm:0.17.19" @@ -2758,6 +2856,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-riscv64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/linux-riscv64@npm:0.23.1" + conditions: os=linux & cpu=riscv64 + languageName: node + linkType: hard + "@esbuild/linux-s390x@npm:0.17.19": version: 0.17.19 resolution: "@esbuild/linux-s390x@npm:0.17.19" @@ -2765,6 +2870,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-s390x@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/linux-s390x@npm:0.23.1" + conditions: os=linux & cpu=s390x + languageName: node + linkType: hard + "@esbuild/linux-x64@npm:0.17.19": version: 0.17.19 resolution: "@esbuild/linux-x64@npm:0.17.19" @@ -2772,6 +2884,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-x64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/linux-x64@npm:0.23.1" + conditions: os=linux & cpu=x64 + languageName: node + linkType: hard + "@esbuild/netbsd-x64@npm:0.17.19": version: 0.17.19 resolution: "@esbuild/netbsd-x64@npm:0.17.19" @@ -2779,6 +2898,20 @@ __metadata: languageName: node linkType: hard +"@esbuild/netbsd-x64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/netbsd-x64@npm:0.23.1" + conditions: os=netbsd & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/openbsd-arm64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/openbsd-arm64@npm:0.23.1" + conditions: os=openbsd & cpu=arm64 + languageName: node + linkType: hard + "@esbuild/openbsd-x64@npm:0.17.19": version: 0.17.19 resolution: "@esbuild/openbsd-x64@npm:0.17.19" @@ -2786,6 +2919,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/openbsd-x64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/openbsd-x64@npm:0.23.1" + conditions: os=openbsd & cpu=x64 + languageName: node + linkType: hard + "@esbuild/sunos-x64@npm:0.17.19": version: 0.17.19 resolution: "@esbuild/sunos-x64@npm:0.17.19" @@ -2793,6 +2933,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/sunos-x64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/sunos-x64@npm:0.23.1" + conditions: os=sunos & cpu=x64 + languageName: node + linkType: hard + "@esbuild/win32-arm64@npm:0.17.19": version: 0.17.19 resolution: "@esbuild/win32-arm64@npm:0.17.19" @@ -2800,6 +2947,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/win32-arm64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/win32-arm64@npm:0.23.1" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + "@esbuild/win32-ia32@npm:0.17.19": version: 0.17.19 resolution: "@esbuild/win32-ia32@npm:0.17.19" @@ -2807,6 +2961,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/win32-ia32@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/win32-ia32@npm:0.23.1" + conditions: os=win32 & cpu=ia32 + languageName: node + linkType: hard + "@esbuild/win32-x64@npm:0.17.19": version: 0.17.19 resolution: "@esbuild/win32-x64@npm:0.17.19" @@ -2814,6 +2975,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/win32-x64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/win32-x64@npm:0.23.1" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + "@eslint-community/eslint-utils@npm:^4.2.0": version: 4.4.0 resolution: "@eslint-community/eslint-utils@npm:4.4.0" @@ -3996,6 +4164,13 @@ __metadata: languageName: node linkType: hard +"@putout/minify@npm:^4.0.0": + version: 4.6.0 + resolution: "@putout/minify@npm:4.6.0" + checksum: c0af85c8d6d0421d03ff081253ce0acae5cfd2b5ab63a1c655283abfc5935e95c7e95494afd4a654d2631d3b1b08cc0a9ed97fce08ce502174f86f313ea25b0e + languageName: node + linkType: hard + "@rc-component/context@npm:^1.4.0": version: 1.4.0 resolution: "@rc-component/context@npm:1.4.0" @@ -4221,9 +4396,9 @@ __metadata: "@segment/analytics-generic-utils": 1.2.0 fake-indexeddb: ^6.0.0 idb: ^8.0.0 + minify: ^11.4.1 node-fetch: ^2.6.7 tslib: ^2.4.1 - workerboxjs: ^6.1.1 peerDependencies: "@segment/analytics-next": ">1.72.0" peerDependenciesMeta: @@ -5798,6 +5973,129 @@ __metadata: languageName: node linkType: hard +"@swc/core-darwin-arm64@npm:1.7.26": + version: 1.7.26 + resolution: "@swc/core-darwin-arm64@npm:1.7.26" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"@swc/core-darwin-x64@npm:1.7.26": + version: 1.7.26 + resolution: "@swc/core-darwin-x64@npm:1.7.26" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"@swc/core-linux-arm-gnueabihf@npm:1.7.26": + version: 1.7.26 + resolution: "@swc/core-linux-arm-gnueabihf@npm:1.7.26" + conditions: os=linux & cpu=arm + languageName: node + linkType: hard + +"@swc/core-linux-arm64-gnu@npm:1.7.26": + version: 1.7.26 + resolution: "@swc/core-linux-arm64-gnu@npm:1.7.26" + conditions: os=linux & cpu=arm64 & libc=glibc + languageName: node + linkType: hard + +"@swc/core-linux-arm64-musl@npm:1.7.26": + version: 1.7.26 + resolution: "@swc/core-linux-arm64-musl@npm:1.7.26" + conditions: os=linux & cpu=arm64 & libc=musl + languageName: node + linkType: hard + +"@swc/core-linux-x64-gnu@npm:1.7.26": + version: 1.7.26 + resolution: "@swc/core-linux-x64-gnu@npm:1.7.26" + conditions: os=linux & cpu=x64 & libc=glibc + languageName: node + linkType: hard + +"@swc/core-linux-x64-musl@npm:1.7.26": + version: 1.7.26 + resolution: "@swc/core-linux-x64-musl@npm:1.7.26" + conditions: os=linux & cpu=x64 & libc=musl + languageName: node + linkType: hard + +"@swc/core-win32-arm64-msvc@npm:1.7.26": + version: 1.7.26 + resolution: "@swc/core-win32-arm64-msvc@npm:1.7.26" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + +"@swc/core-win32-ia32-msvc@npm:1.7.26": + version: 1.7.26 + resolution: "@swc/core-win32-ia32-msvc@npm:1.7.26" + conditions: os=win32 & cpu=ia32 + languageName: node + linkType: hard + +"@swc/core-win32-x64-msvc@npm:1.7.26": + version: 1.7.26 + resolution: "@swc/core-win32-x64-msvc@npm:1.7.26" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + +"@swc/core@npm:^1.6.7": + version: 1.7.26 + resolution: "@swc/core@npm:1.7.26" + dependencies: + "@swc/core-darwin-arm64": 1.7.26 + "@swc/core-darwin-x64": 1.7.26 + "@swc/core-linux-arm-gnueabihf": 1.7.26 + "@swc/core-linux-arm64-gnu": 1.7.26 + "@swc/core-linux-arm64-musl": 1.7.26 + "@swc/core-linux-x64-gnu": 1.7.26 + "@swc/core-linux-x64-musl": 1.7.26 + "@swc/core-win32-arm64-msvc": 1.7.26 + "@swc/core-win32-ia32-msvc": 1.7.26 + "@swc/core-win32-x64-msvc": 1.7.26 + "@swc/counter": ^0.1.3 + "@swc/types": ^0.1.12 + peerDependencies: + "@swc/helpers": "*" + dependenciesMeta: + "@swc/core-darwin-arm64": + optional: true + "@swc/core-darwin-x64": + optional: true + "@swc/core-linux-arm-gnueabihf": + optional: true + "@swc/core-linux-arm64-gnu": + optional: true + "@swc/core-linux-arm64-musl": + optional: true + "@swc/core-linux-x64-gnu": + optional: true + "@swc/core-linux-x64-musl": + optional: true + "@swc/core-win32-arm64-msvc": + optional: true + "@swc/core-win32-ia32-msvc": + optional: true + "@swc/core-win32-x64-msvc": + optional: true + peerDependenciesMeta: + "@swc/helpers": + optional: true + checksum: 8249f2af001f2b5b312ccace4e3a8575bf286bb0f67f029eb58ef8b144f73e37f766800859161ef87c0993e586055238c000ab17dddf9d3760edcfa63ffd22e6 + languageName: node + linkType: hard + +"@swc/counter@npm:^0.1.3": + version: 0.1.3 + resolution: "@swc/counter@npm:0.1.3" + checksum: df8f9cfba9904d3d60f511664c70d23bb323b3a0803ec9890f60133954173047ba9bdeabce28cd70ba89ccd3fd6c71c7b0bd58be85f611e1ffbe5d5c18616598 + languageName: node + linkType: hard + "@swc/helpers@npm:0.4.11": version: 0.4.11 resolution: "@swc/helpers@npm:0.4.11" @@ -5807,6 +6105,15 @@ __metadata: languageName: node linkType: hard +"@swc/types@npm:^0.1.12": + version: 0.1.12 + resolution: "@swc/types@npm:0.1.12" + dependencies: + "@swc/counter": ^0.1.3 + checksum: cf7f89e46f859864075d7965582baea9c5f98830f45b1046251568c9bdf1ca484b1bf37f6d3c32b7c82ecf8cd5df89d22f05268c391819c44e49911bb1a8e71a + languageName: node + linkType: hard + "@szmarczak/http-timer@npm:^1.1.2": version: 1.1.2 resolution: "@szmarczak/http-timer@npm:1.1.2" @@ -9356,7 +9663,7 @@ __metadata: languageName: node linkType: hard -"clean-css@npm:^5.2.2": +"clean-css@npm:^5.0.1, clean-css@npm:^5.2.2, clean-css@npm:~5.3.2": version: 5.3.3 resolution: "clean-css@npm:5.3.3" dependencies: @@ -9607,6 +9914,13 @@ __metadata: languageName: node linkType: hard +"commander@npm:^10.0.0": + version: 10.0.1 + resolution: "commander@npm:10.0.1" + checksum: 436901d64a818295803c1996cd856621a74f30b9f9e28a588e726b2b1670665bccd7c1a77007ebf328729f0139838a88a19265858a0fa7a8728c4656796db948 + languageName: node + linkType: hard + "commander@npm:^2.20.0": version: 2.20.3 resolution: "commander@npm:2.20.3" @@ -10061,6 +10375,15 @@ __metadata: languageName: node linkType: hard +"css-b64-images@npm:~0.2.5": + version: 0.2.5 + resolution: "css-b64-images@npm:0.2.5" + bin: + css-b64-images: bin/css-b64-images + checksum: c4e3480e0cd859407abc223a82d5320cb1a81d63a07954f11bcc913ca486023845fe41869c72373c0b0c594380630742c058cbfb1aba2b3173ccfd7e937c2e33 + languageName: node + linkType: hard + "css-loader@npm:^7.1.2": version: 7.1.2 resolution: "css-loader@npm:7.1.2" @@ -11089,6 +11412,13 @@ __metadata: languageName: node linkType: hard +"entities@npm:^4.4.0": + version: 4.5.0 + resolution: "entities@npm:4.5.0" + checksum: 853f8ebd5b425d350bffa97dd6958143179a5938352ccae092c62d1267c4e392a039be1bae7d51b6e4ffad25f51f9617531fedf5237f15df302ccfb452cbf2d7 + languageName: node + linkType: hard + "env-paths@npm:^2.2.0": version: 2.2.1 resolution: "env-paths@npm:2.2.1" @@ -11599,6 +11929,89 @@ __metadata: languageName: node linkType: hard +"esbuild@npm:^0.23.0": + version: 0.23.1 + resolution: "esbuild@npm:0.23.1" + dependencies: + "@esbuild/aix-ppc64": 0.23.1 + "@esbuild/android-arm": 0.23.1 + "@esbuild/android-arm64": 0.23.1 + "@esbuild/android-x64": 0.23.1 + "@esbuild/darwin-arm64": 0.23.1 + "@esbuild/darwin-x64": 0.23.1 + "@esbuild/freebsd-arm64": 0.23.1 + "@esbuild/freebsd-x64": 0.23.1 + "@esbuild/linux-arm": 0.23.1 + "@esbuild/linux-arm64": 0.23.1 + "@esbuild/linux-ia32": 0.23.1 + "@esbuild/linux-loong64": 0.23.1 + "@esbuild/linux-mips64el": 0.23.1 + "@esbuild/linux-ppc64": 0.23.1 + "@esbuild/linux-riscv64": 0.23.1 + "@esbuild/linux-s390x": 0.23.1 + "@esbuild/linux-x64": 0.23.1 + "@esbuild/netbsd-x64": 0.23.1 + "@esbuild/openbsd-arm64": 0.23.1 + "@esbuild/openbsd-x64": 0.23.1 + "@esbuild/sunos-x64": 0.23.1 + "@esbuild/win32-arm64": 0.23.1 + "@esbuild/win32-ia32": 0.23.1 + "@esbuild/win32-x64": 0.23.1 + dependenciesMeta: + "@esbuild/aix-ppc64": + optional: true + "@esbuild/android-arm": + optional: true + "@esbuild/android-arm64": + optional: true + "@esbuild/android-x64": + optional: true + "@esbuild/darwin-arm64": + optional: true + "@esbuild/darwin-x64": + optional: true + "@esbuild/freebsd-arm64": + optional: true + "@esbuild/freebsd-x64": + optional: true + "@esbuild/linux-arm": + optional: true + "@esbuild/linux-arm64": + optional: true + "@esbuild/linux-ia32": + optional: true + "@esbuild/linux-loong64": + optional: true + "@esbuild/linux-mips64el": + optional: true + "@esbuild/linux-ppc64": + optional: true + "@esbuild/linux-riscv64": + optional: true + "@esbuild/linux-s390x": + optional: true + "@esbuild/linux-x64": + optional: true + "@esbuild/netbsd-x64": + optional: true + "@esbuild/openbsd-arm64": + optional: true + "@esbuild/openbsd-x64": + optional: true + "@esbuild/sunos-x64": + optional: true + "@esbuild/win32-arm64": + optional: true + "@esbuild/win32-ia32": + optional: true + "@esbuild/win32-x64": + optional: true + bin: + esbuild: bin/esbuild + checksum: 0413c3b9257327fb598427688b7186ea335bf1693746fe5713cc93c95854d6388b8ed4ad643fddf5b5ace093f7dcd9038dd58e087bf2da1f04dfb4c5571660af + languageName: node + linkType: hard + "escalade@npm:^3.1.1": version: 3.1.1 resolution: "escalade@npm:3.1.1" @@ -12637,6 +13050,17 @@ __metadata: languageName: node linkType: hard +"find-up@npm:^7.0.0": + version: 7.0.0 + resolution: "find-up@npm:7.0.0" + dependencies: + locate-path: ^7.2.0 + path-exists: ^5.0.0 + unicorn-magic: ^0.1.0 + checksum: e1c63860f9c04355ab2aa19f4be51c1a6e14a7d8cfbd8090e2be6da2a36a76995907cb45337a4b582b19b164388f71d6ab118869dc7bffb2093f2c089ecb95ee + languageName: node + linkType: hard + "find-yarn-workspace-root2@npm:1.2.16": version: 1.2.16 resolution: "find-yarn-workspace-root2@npm:1.2.16" @@ -13656,6 +14080,23 @@ __metadata: languageName: node linkType: hard +"html-minifier-terser@npm:^7.1.0": + version: 7.2.0 + resolution: "html-minifier-terser@npm:7.2.0" + dependencies: + camel-case: ^4.1.2 + clean-css: ~5.3.2 + commander: ^10.0.0 + entities: ^4.4.0 + param-case: ^3.0.4 + relateurl: ^0.2.7 + terser: ^5.15.1 + bin: + html-minifier-terser: cli.js + checksum: 39feed354b5a8aafc8e910977d68cfd961d6db330a8e1a5b16a528c86b8ee7745d8945134822cf00acf7bf0d0135bf1abad650bf308bee4ea73adb003f5b8656 + languageName: node + linkType: hard + "html-webpack-plugin@npm:^5.6.0": version: 5.6.0 resolution: "html-webpack-plugin@npm:5.6.0" @@ -15520,6 +15961,13 @@ __metadata: languageName: node linkType: hard +"jju@npm:^1.4.0": + version: 1.4.0 + resolution: "jju@npm:1.4.0" + checksum: 3790481bd2b7827dd6336e6e3dc2dcc6d425679ba7ebde7b679f61dceb4457ea0cda330972494de608571f4973c6dfb5f70fab6f3c5037dbab19ac449a60424f + languageName: node + linkType: hard + "jmespath@npm:0.15.0": version: 0.15.0 resolution: "jmespath@npm:0.15.0" @@ -16217,7 +16665,7 @@ __metadata: languageName: node linkType: hard -"locate-path@npm:^7.1.0": +"locate-path@npm:^7.1.0, locate-path@npm:^7.2.0": version: 7.2.0 resolution: "locate-path@npm:7.2.0" dependencies: @@ -16931,6 +17379,29 @@ __metadata: languageName: node linkType: hard +"minify@npm:^11.4.1": + version: 11.4.1 + resolution: "minify@npm:11.4.1" + dependencies: + "@putout/minify": ^4.0.0 + "@swc/core": ^1.6.7 + clean-css: ^5.0.1 + css-b64-images: ~0.2.5 + debug: ^4.1.0 + esbuild: ^0.23.0 + find-up: ^7.0.0 + html-minifier-terser: ^7.1.0 + readjson: ^2.2.2 + simport: ^1.2.0 + terser: ^5.28.1 + try-catch: ^3.0.0 + try-to-catch: ^3.0.0 + bin: + minify: bin/minify.js + checksum: 787931f63fc401f87738c72b651097c5417e44aa533723c1d0681182735da768ff2674271288fb74b99c189f641ce822b3c5ae1c3649414aea25ff7546bd4ed9 + languageName: node + linkType: hard + "minimalistic-assert@npm:^1.0.0": version: 1.0.1 resolution: "minimalistic-assert@npm:1.0.1" @@ -19400,6 +19871,16 @@ __metadata: languageName: node linkType: hard +"readjson@npm:^2.2.0, readjson@npm:^2.2.2": + version: 2.2.2 + resolution: "readjson@npm:2.2.2" + dependencies: + jju: ^1.4.0 + try-catch: ^3.0.0 + checksum: 0b091a6b60856cc8a3894275e57ece292cdfe6f716d9f7911979b087d7844819f56e29d563c25adff4904923793b7975e1024d20549732914abd18a0d8f300e1 + languageName: node + linkType: hard + "rechoir@npm:^0.7.0": version: 0.7.0 resolution: "rechoir@npm:0.7.0" @@ -20506,6 +20987,16 @@ __metadata: languageName: node linkType: hard +"simport@npm:^1.2.0": + version: 1.2.0 + resolution: "simport@npm:1.2.0" + dependencies: + readjson: ^2.2.0 + try-to-catch: ^3.0.0 + checksum: 85716020b4c00caf9e6078a2a0c86010fae6011e1d68f1ac84db77441cf2df1f8ff96201f0aaf64fc652ad79cb66f961c059cd7bedc79a77923934230ad6771b + languageName: node + linkType: hard + "sirv@npm:^1.0.7": version: 1.0.11 resolution: "sirv@npm:1.0.11" @@ -21497,6 +21988,20 @@ __metadata: languageName: node linkType: hard +"terser@npm:^5.15.1, terser@npm:^5.28.1": + version: 5.33.0 + resolution: "terser@npm:5.33.0" + dependencies: + "@jridgewell/source-map": ^0.3.3 + acorn: ^8.8.2 + commander: ^2.20.0 + source-map-support: ~0.5.20 + bin: + terser: bin/terser + checksum: e0012bffa595470f481a19952dde18e5a58836eafc63305cf86823fc4406b187ba1b4d6856e1662fb0f464a844a21e7bccf68919128fc43343d58b6ad49485f1 + languageName: node + linkType: hard + "terser@npm:^5.16.8": version: 5.19.2 resolution: "terser@npm:5.19.2" @@ -21716,6 +22221,20 @@ __metadata: languageName: node linkType: hard +"try-catch@npm:^3.0.0": + version: 3.0.1 + resolution: "try-catch@npm:3.0.1" + checksum: 13b4ba1ee0fbdcb0990f0b2656f025bf7703a90d307f60d0d383c002dc5d3d119c3fa750c80f9eb80198e2d0d4d06232f3961bb6629f6b2dc66ab0b39d32e5e4 + languageName: node + linkType: hard + +"try-to-catch@npm:^3.0.0": + version: 3.0.1 + resolution: "try-to-catch@npm:3.0.1" + checksum: ab234d3c9a77632af1d5c2c184c9485ec3a4ed6fca97d4bb304f24b6c1bbe71598ef6d7db14334f4c8090c4f3a4c527faded872db6e402d1661a6898452bc9c7 + languageName: node + linkType: hard + "ts-custom-error@npm:^3.2.0": version: 3.3.1 resolution: "ts-custom-error@npm:3.3.1" @@ -22238,6 +22757,13 @@ __metadata: languageName: node linkType: hard +"unicorn-magic@npm:^0.1.0": + version: 0.1.0 + resolution: "unicorn-magic@npm:0.1.0" + checksum: 48c5882ca3378f380318c0b4eb1d73b7e3c5b728859b060276e0a490051d4180966beeb48962d850fd0c6816543bcdfc28629dcd030bb62a286a2ae2acb5acb6 + languageName: node + linkType: hard + "union@npm:~0.5.0": version: 0.5.0 resolution: "union@npm:0.5.0" @@ -23252,13 +23778,6 @@ __metadata: languageName: node linkType: hard -"workerboxjs@npm:^6.1.1": - version: 6.1.1 - resolution: "workerboxjs@npm:6.1.1" - checksum: 91a013797cf197f17087236fa67e246e7152093ad516e73798fc05de4362b550c1167d56010feb79a4ca4597f0cbf882475f40f5bb66859a91803571d34de14d - languageName: node - linkType: hard - "workerd@npm:1.20231002.0": version: 1.20231002.0 resolution: "workerd@npm:1.20231002.0"