From 504aaa9ce3d9de9ea852269161b6ccdf430c32e7 Mon Sep 17 00:00:00 2001 From: Trezy Date: Mon, 2 Sep 2024 08:51:08 -0500 Subject: [PATCH 01/19] fix: make Application children optional --- src/typedefs/ApplicationProps.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/typedefs/ApplicationProps.ts b/src/typedefs/ApplicationProps.ts index 399e3cd4..91973026 100644 --- a/src/typedefs/ApplicationProps.ts +++ b/src/typedefs/ApplicationProps.ts @@ -20,7 +20,7 @@ export interface BaseApplicationProps className?: string /** @description Child components. */ - children: PixiReactChildNode; + children?: PixiReactChildNode; /** @description The default style to be applied to text nodes. */ defaultTextStyle?: TextStyle | TextStyleOptions, From b91fa7e966cd602273f2a3b88550330a0f5023fd Mon Sep 17 00:00:00 2001 From: Trezy Date: Tue, 3 Sep 2024 07:29:20 -0500 Subject: [PATCH 02/19] fix: handle unmounting `` --- src/components/Application.ts | 38 +++++++++++++++++++++++------- src/helpers/queueForUnmount.ts | 19 +++++++++++++++ src/helpers/unmountApplication.ts | 27 +++++++++++++++++++++ src/helpers/unmountApplications.ts | 10 ++++++++ src/helpers/unqueueForUnmount.ts | 11 +++++++++ src/typedefs/InternalState.ts | 1 + 6 files changed, 98 insertions(+), 8 deletions(-) create mode 100644 src/helpers/queueForUnmount.ts create mode 100644 src/helpers/unmountApplication.ts create mode 100644 src/helpers/unmountApplications.ts create mode 100644 src/helpers/unqueueForUnmount.ts diff --git a/src/components/Application.ts b/src/components/Application.ts index e859df67..e45a1c93 100644 --- a/src/components/Application.ts +++ b/src/components/Application.ts @@ -1,4 +1,5 @@ import { + type Application as PixiApplication, extensions as PixiExtensions, TextStyle, } from 'pixi.js'; @@ -8,14 +9,16 @@ import { type ForwardRefRenderFunction, type MutableRefObject, useCallback, + useEffect, useRef, } from 'react'; import { createRoot } from '../core/createRoot'; +import { roots } from '../core/roots'; +import { queueForUnmount } from '../helpers/queueForUnmount'; +import { unmountApplications } from '../helpers/unmountApplications'; +import { unqueueForUnmount } from '../helpers/unqueueForUnmount'; import { useIsomorphicLayoutEffect } from '../hooks/useIsomorphicLayoutEffect'; import { type ApplicationProps } from '../typedefs/ApplicationProps'; -import { type Root } from '../typedefs/Root'; - -import type { Application as PixiApplication } from 'pixi.js'; const originalDefaultTextStyle = { ...TextStyle.defaultTextStyle }; @@ -39,7 +42,6 @@ export const ApplicationFunction: ForwardRefRenderFunction = useRef(null); const canvasRef: MutableRefObject = useRef(null); const extensionsRef: MutableRefObject> = useRef(new Set()); - const rootRef: MutableRefObject = useRef(null); const updateResizeTo = useCallback(() => { @@ -71,6 +73,8 @@ export const ApplicationFunction: ForwardRefRenderFunction { + unmountApplications(); + if (forwardedRef && ('current' in forwardedRef)) { forwardedRef.current = application; @@ -136,12 +140,14 @@ export const ApplicationFunction: ForwardRefRenderFunction + { + const canvasElement = canvasRef.current; + + if (canvasElement) + { + unqueueForUnmount(canvasElement); + + return () => + { + queueForUnmount(canvasElement); + }; + } + }, []); + return createElement('canvas', { - ref: canvasRef, className, + ref: canvasRef, }); }; diff --git a/src/helpers/queueForUnmount.ts b/src/helpers/queueForUnmount.ts new file mode 100644 index 00000000..ed87da4a --- /dev/null +++ b/src/helpers/queueForUnmount.ts @@ -0,0 +1,19 @@ +import { roots } from '../core/roots'; +import { unmountApplication } from './unmountApplication'; + +export function queueForUnmount(canvas: HTMLCanvasElement) +{ + const root = roots.get(canvas); + + if (root) + { + if (root.applicationState.isInitialised) + { + unmountApplication(root); + } + else + { + root.internalState.queuedForUnmount = true; + } + } +} diff --git a/src/helpers/unmountApplication.ts b/src/helpers/unmountApplication.ts new file mode 100644 index 00000000..29539940 --- /dev/null +++ b/src/helpers/unmountApplication.ts @@ -0,0 +1,27 @@ +import { reconciler } from '../core/reconciler'; +import { roots } from '../core/roots'; +import { type Root } from '../typedefs/Root'; + +export function unmountApplication(root: Root) +{ + if (root.internalState.queuedForUnmount) + { + const fiber = root?.fiber; + + if (fiber) + { + reconciler.updateContainer(null, fiber, null, () => + { + try + { + root.applicationState.app.destroy(); + roots.delete(root.internalState.canvas!); + } + catch (error) + { + /* ... */ + } + }); + } + } +} diff --git a/src/helpers/unmountApplications.ts b/src/helpers/unmountApplications.ts new file mode 100644 index 00000000..fd6234c7 --- /dev/null +++ b/src/helpers/unmountApplications.ts @@ -0,0 +1,10 @@ +import { roots } from '../core/roots'; +import { unmountApplication } from './unmountApplication'; + +export function unmountApplications() +{ + for (const root of roots.values()) + { + unmountApplication(root); + } +} diff --git a/src/helpers/unqueueForUnmount.ts b/src/helpers/unqueueForUnmount.ts new file mode 100644 index 00000000..dc9094e2 --- /dev/null +++ b/src/helpers/unqueueForUnmount.ts @@ -0,0 +1,11 @@ +import { roots } from '../core/roots'; + +export function unqueueForUnmount(canvas: HTMLCanvasElement) +{ + const root = roots.get(canvas); + + if (root) + { + root.internalState.queuedForUnmount = false; + } +} diff --git a/src/typedefs/InternalState.ts b/src/typedefs/InternalState.ts index bd4ecbe6..8d945cfb 100644 --- a/src/typedefs/InternalState.ts +++ b/src/typedefs/InternalState.ts @@ -3,5 +3,6 @@ import type { HostConfig } from './HostConfig'; export interface InternalState { canvas?: HTMLCanvasElement; + queuedForUnmount?: boolean; rootContainer: HostConfig['containerInstance']; } From 110ba3d0d74c1bac119c25a9199af3660ec2d7f1 Mon Sep 17 00:00:00 2001 From: Trezy Date: Tue, 3 Sep 2024 07:29:56 -0500 Subject: [PATCH 03/19] test: add test for ``s `onInit` --- .../workflows/handle-release-branch-push.yml | 35 +++++++++++++++++-- test/e2e/components/Application.test.tsx | 33 +++++++++++++++++ 2 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 test/e2e/components/Application.test.tsx diff --git a/.github/workflows/handle-release-branch-push.yml b/.github/workflows/handle-release-branch-push.yml index e9431ef0..a140dfdc 100644 --- a/.github/workflows/handle-release-branch-push.yml +++ b/.github/workflows/handle-release-branch-push.yml @@ -49,14 +49,14 @@ jobs: with: fetch-depth: 0 - - name: Setup Project + - name: Setup project uses: ./.github/actions/setup - name: Build Project run: npm run build shell: bash - - name: Semantic Release + - name: Semantic release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} id: release @@ -71,3 +71,34 @@ jobs: if: ${{ steps.release.outputs.new_tag_version != '' }} run: npm publish ./dist/*.tgz --tag ${{ (github.head_ref || github.ref_name) == 'main' && 'latest' || github.head_ref || github.ref_name }} shell: bash + + dev-publish: + name: 'Publish: Dev' + needs: + - verify + if: contains(fromJson('["refs/heads/alpha", "refs/heads/beta", "refs/heads/main"]'), github.ref) == 'false' + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup project + uses: ./.github/actions/setup + + - name: Build project + run: npm run build + shell: bash + + - name: Get current version + run: echo "PACKAGE_VERSION=$(npm pkg get version | tr -d '"')" >> $GITHUB_ENV + + - name: Setup dev version + run: echo "BRANCH_VERSION=$PACKAGE_VERSION-$BRANCH_NAME.${GITHUB_SHA::7}" >> $GITHUB_ENV + + - name: Bump version + run: npm version $BRANCH_VERSION --no-git-tag-version --force + + - name: Publish a dev release + run: npm publish --tag dev diff --git a/test/e2e/components/Application.test.tsx b/test/e2e/components/Application.test.tsx new file mode 100644 index 00000000..672e3442 --- /dev/null +++ b/test/e2e/components/Application.test.tsx @@ -0,0 +1,33 @@ +import { + describe, + expect, + it, + vi, +} from 'vitest'; +import { render } from '@testing-library/react' + +import { Application } from '../../../src/components/Application' +import { wait } from '../../utils/wait'; + +describe('Application', () => +{ + describe('onInit', () => { + it('runs the callback', async () => { + const onInitSpy = vi.fn() + + const TestComponent = function() { + return ( + + ) + } + + render(( + + )) + + await wait(1000) + + expect(onInitSpy.mock.calls.length).to.equal(1) + }); + }) +}); From 6ac48acff9e52edb9779ff0d70e661b11b9150e7 Mon Sep 17 00:00:00 2001 From: Trezy Date: Tue, 3 Sep 2024 10:03:38 -0500 Subject: [PATCH 04/19] ci: temp disable dev publish --- .../workflows/handle-release-branch-push.yml | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/.github/workflows/handle-release-branch-push.yml b/.github/workflows/handle-release-branch-push.yml index a140dfdc..5527ea3e 100644 --- a/.github/workflows/handle-release-branch-push.yml +++ b/.github/workflows/handle-release-branch-push.yml @@ -38,7 +38,7 @@ jobs: run: npm run ${{ matrix.script.command }} publish: - name: Publish + name: 'Publish: Release' needs: - verify if: contains(fromJson('["refs/heads/alpha", "refs/heads/beta", "refs/heads/main"]'), github.ref) @@ -72,33 +72,33 @@ jobs: run: npm publish ./dist/*.tgz --tag ${{ (github.head_ref || github.ref_name) == 'main' && 'latest' || github.head_ref || github.ref_name }} shell: bash - dev-publish: - name: 'Publish: Dev' - needs: - - verify - if: contains(fromJson('["refs/heads/alpha", "refs/heads/beta", "refs/heads/main"]'), github.ref) == 'false' - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 + # dev-publish: + # name: 'Publish: Dev' + # needs: + # - verify + # if: contains(fromJson('["refs/heads/alpha", "refs/heads/beta", "refs/heads/main"]'), github.ref) == 'false' + # runs-on: ubuntu-latest + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + # with: + # fetch-depth: 0 - - name: Setup project - uses: ./.github/actions/setup + # - name: Setup project + # uses: ./.github/actions/setup - - name: Build project - run: npm run build - shell: bash + # - name: Build project + # run: npm run build + # shell: bash - - name: Get current version - run: echo "PACKAGE_VERSION=$(npm pkg get version | tr -d '"')" >> $GITHUB_ENV + # - name: Get current version + # run: echo "PACKAGE_VERSION=$(npm pkg get version | tr -d '"')" >> $GITHUB_ENV - - name: Setup dev version - run: echo "BRANCH_VERSION=$PACKAGE_VERSION-$BRANCH_NAME.${GITHUB_SHA::7}" >> $GITHUB_ENV + # - name: Setup dev version + # run: echo "BRANCH_VERSION=$PACKAGE_VERSION-$BRANCH_NAME.${GITHUB_SHA::7}" >> $GITHUB_ENV - - name: Bump version - run: npm version $BRANCH_VERSION --no-git-tag-version --force + # - name: Bump version + # run: npm version $BRANCH_VERSION --no-git-tag-version --force - - name: Publish a dev release - run: npm publish --tag dev + # - name: Publish a dev release + # run: npm publish --tag dev From b370e5a8a1c0cc7b852c3b9d629a84a6a09c22a6 Mon Sep 17 00:00:00 2001 From: Trezy Date: Tue, 3 Sep 2024 15:11:52 -0500 Subject: [PATCH 05/19] test: test `` unmounts --- test/e2e/components/Application.test.tsx | 90 +++++++++++++++++++----- vitest.setup.ts | 12 ++-- vitest.workspace.ts | 4 +- 3 files changed, 79 insertions(+), 27 deletions(-) diff --git a/test/e2e/components/Application.test.tsx b/test/e2e/components/Application.test.tsx index 672e3442..74345a8e 100644 --- a/test/e2e/components/Application.test.tsx +++ b/test/e2e/components/Application.test.tsx @@ -3,31 +3,83 @@ import { expect, it, vi, -} from 'vitest'; +} from 'vitest' +import { type Application as PixiApplication } from 'pixi.js' import { render } from '@testing-library/react' +import { useEffect } from 'react' import { Application } from '../../../src/components/Application' -import { wait } from '../../utils/wait'; +import { useApplication } from '../../../src/hooks/useApplication' -describe('Application', () => -{ - describe('onInit', () => { - it('runs the callback', async () => { - const onInitSpy = vi.fn() +describe('Application', () => { + it('runs the `onInit` callback', async () => { + const onInitSpy = vi.fn() - const TestComponent = function() { - return ( - - ) - } + const TestComponent = () => ( + + ) - render(( - - )) + render() - await wait(1000) + await expect.poll(() => onInitSpy.mock.calls.length).toEqual(1) + }); - expect(onInitSpy.mock.calls.length).to.equal(1) - }); + it('unmounts after init', async () => { + let testApp: PixiApplication | null = null + + const TestChildComponent = () => { + const { app } = useApplication() + + useEffect(() => { + testApp = app + + return () => { + testApp = app + } + }, [app]) + + return null + } + + const TestComponent = () => ( + + + + ) + + const { unmount } = render() + + await expect.poll(() => Boolean(testApp?.renderer)).toBeTruthy() + + unmount() + + await expect.poll(() => !testApp?.renderer).toBeFalsy() + await expect.poll(() => !testApp?.stage).toBeFalsy() }) -}); + + it('unmounts during init', async () => { + let testApp: PixiApplication | null = null + + const TestChildComponent = () => { + testApp = useApplication().app + + return null + } + + const TestComponent = () => ( + + + + ) + + const { unmount } = render() + + await expect.poll(() => !testApp?.renderer).toBeFalsy() + await expect.poll(() => !testApp?.stage).toBeFalsy() + + unmount() + + await expect.poll(() => !testApp?.renderer).toBeFalsy() + await expect.poll(() => !testApp?.stage).toBeFalsy() + }); +}) diff --git a/vitest.setup.ts b/vitest.setup.ts index b06f1468..f097bb90 100644 --- a/vitest.setup.ts +++ b/vitest.setup.ts @@ -1,8 +1,10 @@ import { afterEach } from 'vitest'; import '@testing-library/jest-dom/vitest'; -import { cleanup } from '@testing-library/react'; +import { + cleanup, + configure, +} from '@testing-library/react'; -afterEach(() => -{ - cleanup(); -}); +configure({ reactStrictMode: true }); + +afterEach(() => cleanup()); diff --git a/vitest.workspace.ts b/vitest.workspace.ts index 07b989c6..a8ca1632 100644 --- a/vitest.workspace.ts +++ b/vitest.workspace.ts @@ -20,9 +20,7 @@ export default defineWorkspace([ }, globals: true, include: ['test/e2e/**/*.test.ts(x)'], - setupFiles: [ - './vitest.setup.ts' - ], + setupFiles: ['./vitest.setup.ts'], }, }, ]); From e0b6e4bf9486263ae941ca22a500ebb25d4cfd0d Mon Sep 17 00:00:00 2001 From: Trezy Date: Tue, 3 Sep 2024 22:59:56 -0500 Subject: [PATCH 06/19] chore: rename `unmountApplications` to `processUnmountedQueue` for clarity --- src/components/Application.ts | 4 ++-- .../{unmountApplications.ts => processUnmountQueue.ts} | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename src/helpers/{unmountApplications.ts => processUnmountQueue.ts} (83%) diff --git a/src/components/Application.ts b/src/components/Application.ts index e45a1c93..be080259 100644 --- a/src/components/Application.ts +++ b/src/components/Application.ts @@ -14,8 +14,8 @@ import { } from 'react'; import { createRoot } from '../core/createRoot'; import { roots } from '../core/roots'; +import { processUnmountQueue } from '../helpers/processUnmountQueue'; import { queueForUnmount } from '../helpers/queueForUnmount'; -import { unmountApplications } from '../helpers/unmountApplications'; import { unqueueForUnmount } from '../helpers/unqueueForUnmount'; import { useIsomorphicLayoutEffect } from '../hooks/useIsomorphicLayoutEffect'; import { type ApplicationProps } from '../typedefs/ApplicationProps'; @@ -73,7 +73,7 @@ export const ApplicationFunction: ForwardRefRenderFunction { - unmountApplications(); + processUnmountQueue(); if (forwardedRef && ('current' in forwardedRef)) { diff --git a/src/helpers/unmountApplications.ts b/src/helpers/processUnmountQueue.ts similarity index 83% rename from src/helpers/unmountApplications.ts rename to src/helpers/processUnmountQueue.ts index fd6234c7..50f9c6b2 100644 --- a/src/helpers/unmountApplications.ts +++ b/src/helpers/processUnmountQueue.ts @@ -1,7 +1,7 @@ import { roots } from '../core/roots'; import { unmountApplication } from './unmountApplication'; -export function unmountApplications() +export function processUnmountQueue() { for (const root of roots.values()) { From 14635f116210e250ab53f22a260efbf2923c9062 Mon Sep 17 00:00:00 2001 From: Trezy Date: Tue, 3 Sep 2024 23:00:22 -0500 Subject: [PATCH 07/19] chore: remove unnecessary optional operator --- src/helpers/unmountApplication.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/helpers/unmountApplication.ts b/src/helpers/unmountApplication.ts index 29539940..6a5ef2d7 100644 --- a/src/helpers/unmountApplication.ts +++ b/src/helpers/unmountApplication.ts @@ -6,7 +6,7 @@ export function unmountApplication(root: Root) { if (root.internalState.queuedForUnmount) { - const fiber = root?.fiber; + const fiber = root.fiber; if (fiber) { From 62aae0bc94e986639ab835f6c43aa5d3d2a5c2cb Mon Sep 17 00:00:00 2001 From: Trezy Date: Tue, 3 Sep 2024 23:00:47 -0500 Subject: [PATCH 08/19] chore: code style --- test/e2e/components/Application.test.tsx | 110 ++++++++++++----------- 1 file changed, 57 insertions(+), 53 deletions(-) diff --git a/test/e2e/components/Application.test.tsx b/test/e2e/components/Application.test.tsx index 74345a8e..ca9e7299 100644 --- a/test/e2e/components/Application.test.tsx +++ b/test/e2e/components/Application.test.tsx @@ -4,82 +4,86 @@ import { it, vi, } from 'vitest' -import { type Application as PixiApplication } from 'pixi.js' -import { render } from '@testing-library/react' -import { useEffect } from 'react' +import { type Application as PixiApplication } from 'pixi.js'; +import { render } from '@testing-library/react'; +import { useEffect } from 'react'; -import { Application } from '../../../src/components/Application' -import { useApplication } from '../../../src/hooks/useApplication' +import { Application } from '../../../src/components/Application'; +import { useApplication } from '../../../src/hooks/useApplication'; describe('Application', () => { - it('runs the `onInit` callback', async () => { - const onInitSpy = vi.fn() + describe('onInit', () => { + it('runs the callback once', async () => { + const onInitSpy = vi.fn(); - const TestComponent = () => ( - - ) + const TestComponent = () => ( + + ); - render() + render(); - await expect.poll(() => onInitSpy.mock.calls.length).toEqual(1) + await expect.poll(() => onInitSpy.mock.calls.length).toEqual(1); + }); }); - it('unmounts after init', async () => { - let testApp: PixiApplication | null = null + describe('unmount', () => { + it('unmounts after init', async () => { + let testApp: PixiApplication | null = null; - const TestChildComponent = () => { - const { app } = useApplication() + const TestChildComponent = () => { + const { app } = useApplication(); - useEffect(() => { - testApp = app + useEffect(() => { + testApp = app; - return () => { - testApp = app - } - }, [app]) + return () => { + testApp = app; + } + }, [app]); - return null - } + return null; + }; - const TestComponent = () => ( - - - - ) + const TestComponent = () => ( + + + + ); - const { unmount } = render() + const { unmount } = render(); - await expect.poll(() => Boolean(testApp?.renderer)).toBeTruthy() + await expect.poll(() => Boolean(testApp?.renderer)).toBeTruthy(); - unmount() + unmount(); - await expect.poll(() => !testApp?.renderer).toBeFalsy() - await expect.poll(() => !testApp?.stage).toBeFalsy() - }) + await expect.poll(() => !testApp?.renderer).toBeFalsy(); + await expect.poll(() => !testApp?.stage).toBeFalsy(); + }); - it('unmounts during init', async () => { - let testApp: PixiApplication | null = null + it('unmounts during init', async () => { + let testApp: PixiApplication | null = null; - const TestChildComponent = () => { - testApp = useApplication().app + const TestChildComponent = () => { + testApp = useApplication().app; - return null - } + return null; + }; - const TestComponent = () => ( - - - - ) + const TestComponent = () => ( + + + + ); - const { unmount } = render() + const { unmount } = render(); - await expect.poll(() => !testApp?.renderer).toBeFalsy() - await expect.poll(() => !testApp?.stage).toBeFalsy() + await expect.poll(() => !testApp?.renderer).toBeFalsy(); + await expect.poll(() => !testApp?.stage).toBeFalsy(); - unmount() + unmount(); - await expect.poll(() => !testApp?.renderer).toBeFalsy() - await expect.poll(() => !testApp?.stage).toBeFalsy() + await expect.poll(() => !testApp?.renderer).toBeFalsy(); + await expect.poll(() => !testApp?.stage).toBeFalsy(); + }); }); -}) +}); From 6429bb404ae719f6605d0244a67115fb5d54e5d7 Mon Sep 17 00:00:00 2001 From: Trezy Date: Tue, 3 Sep 2024 23:02:13 -0500 Subject: [PATCH 09/19] test: update `useTick` tests to use `expect.poll` --- test/e2e/hooks/useTick.test.tsx | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/test/e2e/hooks/useTick.test.tsx b/test/e2e/hooks/useTick.test.tsx index 5ff08482..79f411bc 100644 --- a/test/e2e/hooks/useTick.test.tsx +++ b/test/e2e/hooks/useTick.test.tsx @@ -12,7 +12,6 @@ import { Ticker } from 'pixi.js'; import { Application } from '../../../src/components/Application' import { useTick } from '../../../src/hooks/useTick' -import { wait } from '../../utils/wait' describe('useTick', () => { @@ -28,9 +27,7 @@ describe('useTick', () => render(, { wrapper: Application }) - await wait(100) - - expect(useTickSpy.mock.lastCall?.[0]).to.be.instanceOf(Ticker) + await expect.poll(() => useTickSpy.mock.lastCall?.[0]).toBeInstanceOf(Ticker) }); }) @@ -46,9 +43,7 @@ describe('useTick', () => render(, { wrapper: Application }) - await wait(100) - - expect(useTickSpy.mock.lastCall?.[0]).to.be.instanceOf(Ticker) + await expect.poll(() => useTickSpy.mock.lastCall?.[0]).toBeInstanceOf(Ticker) }); }) From f429cd6c52bf9e701b31ee77c3dbfad0d3b5b459 Mon Sep 17 00:00:00 2001 From: Trezy Date: Tue, 3 Sep 2024 23:02:51 -0500 Subject: [PATCH 10/19] chore: remove unused test util --- test/utils/wait.ts | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 test/utils/wait.ts diff --git a/test/utils/wait.ts b/test/utils/wait.ts deleted file mode 100644 index a2aeccde..00000000 --- a/test/utils/wait.ts +++ /dev/null @@ -1,7 +0,0 @@ -export function wait(waitMS: number, rejectOnComplete: boolean = false) -{ - return new Promise((resolve, reject) => - { - setTimeout(rejectOnComplete ? reject : resolve, waitMS); - }); -} From 8e2ad700c9a82ec535127f8cef92b6b94e7e3512 Mon Sep 17 00:00:00 2001 From: Trezy Date: Tue, 3 Sep 2024 23:42:25 -0500 Subject: [PATCH 11/19] refactor: check app state instead of eating the destroy error --- src/helpers/unmountApplication.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/helpers/unmountApplication.ts b/src/helpers/unmountApplication.ts index 6a5ef2d7..7cd04896 100644 --- a/src/helpers/unmountApplication.ts +++ b/src/helpers/unmountApplication.ts @@ -12,15 +12,12 @@ export function unmountApplication(root: Root) { reconciler.updateContainer(null, fiber, null, () => { - try + if (root.applicationState.app) { root.applicationState.app.destroy(); - roots.delete(root.internalState.canvas!); - } - catch (error) - { - /* ... */ } + + roots.delete(root.internalState.canvas!); }); } } From e6298271452f2439f9e29ce2f5d50fd0ae93f766 Mon Sep 17 00:00:00 2001 From: Trezy Date: Wed, 4 Sep 2024 08:39:46 -0500 Subject: [PATCH 12/19] refactor: use a Set for unmount queue --- src/helpers/processUnmountQueue.ts | 4 +- src/helpers/queueForUnmount.ts | 3 +- src/helpers/unmountApplication.ts | 24 +++++------ src/helpers/unqueueForUnmount.ts | 3 +- src/store.ts | 8 +++- src/typedefs/InternalState.ts | 1 - test/e2e/components/Application.test.tsx | 51 +++++++++++++++++------- 7 files changed, 62 insertions(+), 32 deletions(-) diff --git a/src/helpers/processUnmountQueue.ts b/src/helpers/processUnmountQueue.ts index 50f9c6b2..26f7cf3a 100644 --- a/src/helpers/processUnmountQueue.ts +++ b/src/helpers/processUnmountQueue.ts @@ -1,9 +1,9 @@ -import { roots } from '../core/roots'; +import { store } from '../store'; import { unmountApplication } from './unmountApplication'; export function processUnmountQueue() { - for (const root of roots.values()) + for (const root of store.unmountQueue) { unmountApplication(root); } diff --git a/src/helpers/queueForUnmount.ts b/src/helpers/queueForUnmount.ts index ed87da4a..8c733a53 100644 --- a/src/helpers/queueForUnmount.ts +++ b/src/helpers/queueForUnmount.ts @@ -1,4 +1,5 @@ import { roots } from '../core/roots'; +import { store } from '../store'; import { unmountApplication } from './unmountApplication'; export function queueForUnmount(canvas: HTMLCanvasElement) @@ -13,7 +14,7 @@ export function queueForUnmount(canvas: HTMLCanvasElement) } else { - root.internalState.queuedForUnmount = true; + store.unmountQueue.add(root); } } } diff --git a/src/helpers/unmountApplication.ts b/src/helpers/unmountApplication.ts index 7cd04896..26992eb7 100644 --- a/src/helpers/unmountApplication.ts +++ b/src/helpers/unmountApplication.ts @@ -1,24 +1,24 @@ import { reconciler } from '../core/reconciler'; import { roots } from '../core/roots'; +import { store } from '../store'; import { type Root } from '../typedefs/Root'; export function unmountApplication(root: Root) { - if (root.internalState.queuedForUnmount) - { - const fiber = root.fiber; + store.unmountQueue.delete(root); + + const fiber = root.fiber; - if (fiber) + if (fiber) + { + reconciler.updateContainer(null, fiber, null, () => { - reconciler.updateContainer(null, fiber, null, () => + if (root.applicationState.app) { - if (root.applicationState.app) - { - root.applicationState.app.destroy(); - } + root.applicationState.app.destroy(); + } - roots.delete(root.internalState.canvas!); - }); - } + roots.delete(root.internalState.canvas!); + }); } } diff --git a/src/helpers/unqueueForUnmount.ts b/src/helpers/unqueueForUnmount.ts index dc9094e2..a23ce609 100644 --- a/src/helpers/unqueueForUnmount.ts +++ b/src/helpers/unqueueForUnmount.ts @@ -1,4 +1,5 @@ import { roots } from '../core/roots'; +import { store } from '../store'; export function unqueueForUnmount(canvas: HTMLCanvasElement) { @@ -6,6 +7,6 @@ export function unqueueForUnmount(canvas: HTMLCanvasElement) if (root) { - root.internalState.queuedForUnmount = false; + store.unmountQueue.delete(root); } } diff --git a/src/store.ts b/src/store.ts index 7c63055e..983b9054 100644 --- a/src/store.ts +++ b/src/store.ts @@ -1,5 +1,11 @@ -const store = { +import { type Root } from './typedefs/Root'; + +const store: { + debug: boolean, + unmountQueue: Set, +} = { debug: false, + unmountQueue: new Set(), }; export { store }; diff --git a/src/typedefs/InternalState.ts b/src/typedefs/InternalState.ts index 8d945cfb..bd4ecbe6 100644 --- a/src/typedefs/InternalState.ts +++ b/src/typedefs/InternalState.ts @@ -3,6 +3,5 @@ import type { HostConfig } from './HostConfig'; export interface InternalState { canvas?: HTMLCanvasElement; - queuedForUnmount?: boolean; rootContainer: HostConfig['containerInstance']; } diff --git a/test/e2e/components/Application.test.tsx b/test/e2e/components/Application.test.tsx index ca9e7299..90e4c282 100644 --- a/test/e2e/components/Application.test.tsx +++ b/test/e2e/components/Application.test.tsx @@ -28,18 +28,27 @@ describe('Application', () => { describe('unmount', () => { it('unmounts after init', async () => { - let testApp: PixiApplication | null = null; + let testApp = null as any as PixiApplication; + let testAppIsInitialised = false; const TestChildComponent = () => { - const { app } = useApplication(); + const { + app, + isInitialised, + } = useApplication(); useEffect(() => { - testApp = app; + testApp = app + testAppIsInitialised = isInitialised return () => { - testApp = app; + testApp = app + testAppIsInitialised = isInitialised } - }, [app]); + }, [ + app, + isInitialised, + ]) return null; }; @@ -52,19 +61,35 @@ describe('Application', () => { const { unmount } = render(); - await expect.poll(() => Boolean(testApp?.renderer)).toBeTruthy(); + await expect.poll(() => testAppIsInitialised).toEqual(true); unmount(); - await expect.poll(() => !testApp?.renderer).toBeFalsy(); - await expect.poll(() => !testApp?.stage).toBeFalsy(); + await expect.poll(() => Boolean(testApp.renderer && testApp.stage)).toBeFalsy(); }); it('unmounts during init', async () => { - let testApp: PixiApplication | null = null; + let testApp = null as any as PixiApplication; + let testAppIsInitialised = false; const TestChildComponent = () => { - testApp = useApplication().app; + const { + app, + isInitialised, + } = useApplication(); + + useEffect(() => { + testApp = app + testAppIsInitialised = isInitialised + + return () => { + testApp = app + testAppIsInitialised = isInitialised + } + }, [ + app, + isInitialised, + ]) return null; }; @@ -77,13 +102,11 @@ describe('Application', () => { const { unmount } = render(); - await expect.poll(() => !testApp?.renderer).toBeFalsy(); - await expect.poll(() => !testApp?.stage).toBeFalsy(); + expect(testAppIsInitialised).to.be.false; unmount(); - await expect.poll(() => !testApp?.renderer).toBeFalsy(); - await expect.poll(() => !testApp?.stage).toBeFalsy(); + await expect.poll(() => Boolean(testApp.renderer && testApp.stage)).toBeFalsy(); }); }); }); From 2592a348b4c4ed4383681272dae5fc545b9678f2 Mon Sep 17 00:00:00 2001 From: Trezy Date: Wed, 4 Sep 2024 08:54:48 -0500 Subject: [PATCH 13/19] refactor: rename `unmountApplication` to `unmountRoot` for clarity --- src/helpers/processUnmountQueue.ts | 4 ++-- src/helpers/queueForUnmount.ts | 4 ++-- src/helpers/{unmountApplication.ts => unmountRoot.ts} | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) rename src/helpers/{unmountApplication.ts => unmountRoot.ts} (91%) diff --git a/src/helpers/processUnmountQueue.ts b/src/helpers/processUnmountQueue.ts index 26f7cf3a..c9d08db3 100644 --- a/src/helpers/processUnmountQueue.ts +++ b/src/helpers/processUnmountQueue.ts @@ -1,10 +1,10 @@ import { store } from '../store'; -import { unmountApplication } from './unmountApplication'; +import { unmountRoot } from './unmountRoot'; export function processUnmountQueue() { for (const root of store.unmountQueue) { - unmountApplication(root); + unmountRoot(root); } } diff --git a/src/helpers/queueForUnmount.ts b/src/helpers/queueForUnmount.ts index 8c733a53..d2278cab 100644 --- a/src/helpers/queueForUnmount.ts +++ b/src/helpers/queueForUnmount.ts @@ -1,6 +1,6 @@ import { roots } from '../core/roots'; import { store } from '../store'; -import { unmountApplication } from './unmountApplication'; +import { unmountRoot } from './unmountRoot'; export function queueForUnmount(canvas: HTMLCanvasElement) { @@ -10,7 +10,7 @@ export function queueForUnmount(canvas: HTMLCanvasElement) { if (root.applicationState.isInitialised) { - unmountApplication(root); + unmountRoot(root); } else { diff --git a/src/helpers/unmountApplication.ts b/src/helpers/unmountRoot.ts similarity index 91% rename from src/helpers/unmountApplication.ts rename to src/helpers/unmountRoot.ts index 26992eb7..e2781e1f 100644 --- a/src/helpers/unmountApplication.ts +++ b/src/helpers/unmountRoot.ts @@ -3,7 +3,7 @@ import { roots } from '../core/roots'; import { store } from '../store'; import { type Root } from '../typedefs/Root'; -export function unmountApplication(root: Root) +export function unmountRoot(root: Root) { store.unmountQueue.delete(root); From 57434d80d3c431e41fd8c860b59216cb74b4fd79 Mon Sep 17 00:00:00 2001 From: Trezy Date: Wed, 4 Sep 2024 08:55:20 -0500 Subject: [PATCH 14/19] test: improve unmounted app check --- test/e2e/components/Application.test.tsx | 5 +++-- test/utils/getAppRoot.ts | 19 +++++++++++++++++++ test/utils/isAppMounted.ts | 22 ++++++++++++++++++++++ 3 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 test/utils/getAppRoot.ts create mode 100644 test/utils/isAppMounted.ts diff --git a/test/e2e/components/Application.test.tsx b/test/e2e/components/Application.test.tsx index 90e4c282..875c6905 100644 --- a/test/e2e/components/Application.test.tsx +++ b/test/e2e/components/Application.test.tsx @@ -9,6 +9,7 @@ import { render } from '@testing-library/react'; import { useEffect } from 'react'; import { Application } from '../../../src/components/Application'; +import { isAppMounted } from '../../utils/isAppMounted'; import { useApplication } from '../../../src/hooks/useApplication'; describe('Application', () => { @@ -65,7 +66,7 @@ describe('Application', () => { unmount(); - await expect.poll(() => Boolean(testApp.renderer && testApp.stage)).toBeFalsy(); + await expect.poll(() => isAppMounted(testApp)).toBeFalsy(); }); it('unmounts during init', async () => { @@ -106,7 +107,7 @@ describe('Application', () => { unmount(); - await expect.poll(() => Boolean(testApp.renderer && testApp.stage)).toBeFalsy(); + await expect.poll(() => isAppMounted(testApp)).toBeFalsy(); }); }); }); diff --git a/test/utils/getAppRoot.ts b/test/utils/getAppRoot.ts new file mode 100644 index 00000000..dcf8763b --- /dev/null +++ b/test/utils/getAppRoot.ts @@ -0,0 +1,19 @@ +import { type Application as PixiApplication } from 'pixi.js'; +import { roots } from '../../src/core/roots'; +import { type Root } from '../../src/typedefs/Root'; + +export function getAppRoot(app: PixiApplication) +{ + let root: Root | undefined; + + for (const oRoot of roots.values()) + { + if (oRoot.applicationState.app === app) + { + root = oRoot; + break; + } + } + + return root; +} diff --git a/test/utils/isAppMounted.ts b/test/utils/isAppMounted.ts new file mode 100644 index 00000000..6bae6556 --- /dev/null +++ b/test/utils/isAppMounted.ts @@ -0,0 +1,22 @@ +import { type Application as PixiApplication } from 'pixi.js'; +import { getAppRoot } from './getAppRoot'; + +export function isAppMounted(app: PixiApplication) +{ + if (app.stage === null) + { + return false; + } + + if (app.renderer === null) + { + return false; + } + + if (typeof getAppRoot(app) === 'undefined') + { + return false; + } + + return true; +} From 78d6b966be12275223f82266732d22a8e27505f3 Mon Sep 17 00:00:00 2001 From: Trezy Date: Wed, 25 Dec 2024 22:46:13 -0600 Subject: [PATCH 15/19] test: verify applications are removed from the roots cache after unmount --- test/e2e/components/Application.test.tsx | 64 +++++++++++++++--------- 1 file changed, 41 insertions(+), 23 deletions(-) diff --git a/test/e2e/components/Application.test.tsx b/test/e2e/components/Application.test.tsx index 875c6905..6c346dce 100644 --- a/test/e2e/components/Application.test.tsx +++ b/test/e2e/components/Application.test.tsx @@ -1,19 +1,20 @@ +import { type Application as PixiApplication } from 'pixi.js'; +import { useEffect } from 'react'; import { describe, expect, it, vi, } from 'vitest' -import { type Application as PixiApplication } from 'pixi.js'; -import { render } from '@testing-library/react'; -import { useEffect } from 'react'; - import { Application } from '../../../src/components/Application'; -import { isAppMounted } from '../../utils/isAppMounted'; +import { roots } from '../../../src/core/roots'; import { useApplication } from '../../../src/hooks/useApplication'; +import { isAppMounted } from '../../utils/isAppMounted'; +import { render } from '@testing-library/react'; describe('Application', () => { - describe('onInit', () => { + describe('onInit', () => + { it('runs the callback once', async () => { const onInitSpy = vi.fn(); @@ -28,7 +29,8 @@ describe('Application', () => { }); describe('unmount', () => { - it('unmounts after init', async () => { + it('unmounts after init', async () => + { let testApp = null as any as PixiApplication; let testAppIsInitialised = false; @@ -38,18 +40,19 @@ describe('Application', () => { isInitialised, } = useApplication(); - useEffect(() => { - testApp = app - testAppIsInitialised = isInitialised + useEffect(() => + { + testApp = app; + testAppIsInitialised = isInitialised; return () => { - testApp = app - testAppIsInitialised = isInitialised - } + testApp = app; + testAppIsInitialised = isInitialised; + }; }, [ app, isInitialised, - ]) + ]); return null; }; @@ -60,37 +63,46 @@ describe('Application', () => { ); + expect(roots.size).toEqual(0); + const { unmount } = render(); + expect(roots.size).toEqual(1); + await expect.poll(() => testAppIsInitialised).toEqual(true); unmount(); + expect(roots.size).toEqual(0); + await expect.poll(() => isAppMounted(testApp)).toBeFalsy(); }); - it('unmounts during init', async () => { + it('unmounts during init', async () => + { let testApp = null as any as PixiApplication; let testAppIsInitialised = false; - const TestChildComponent = () => { + const TestChildComponent = () => + { const { app, isInitialised, } = useApplication(); - useEffect(() => { - testApp = app - testAppIsInitialised = isInitialised + useEffect(() => + { + testApp = app; + testAppIsInitialised = isInitialised; return () => { - testApp = app - testAppIsInitialised = isInitialised - } + testApp = app; + testAppIsInitialised = isInitialised; + }; }, [ app, isInitialised, - ]) + ]); return null; }; @@ -101,13 +113,19 @@ describe('Application', () => { ); + expect(roots.size).toEqual(0); + const { unmount } = render(); + expect(roots.size).toEqual(1); + expect(testAppIsInitialised).to.be.false; unmount(); await expect.poll(() => isAppMounted(testApp)).toBeFalsy(); + + expect(roots.size).toEqual(0); }); }); }); From 4d8f15bedf118836dff0c736dc0f99c0d4e4ce90 Mon Sep 17 00:00:00 2001 From: Trezy Date: Wed, 25 Dec 2024 22:46:40 -0600 Subject: [PATCH 16/19] fix: make sure applications always have a canvas in internal state --- src/core/createRoot.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/core/createRoot.ts b/src/core/createRoot.ts index 1c062157..d2d4c601 100644 --- a/src/core/createRoot.ts +++ b/src/core/createRoot.ts @@ -76,6 +76,8 @@ export function createRoot( target.appendChild(canvas); } + internalState.canvas = canvas; + const render = async ( children: ReactNode, applicationOptions: ApplicationOptions, From 53cddcd51911689d7527165644e94f07866d04d8 Mon Sep 17 00:00:00 2001 From: Trezy Date: Wed, 25 Dec 2024 22:56:34 -0600 Subject: [PATCH 17/19] build: update import attributes Signed-off-by: Trezy --- rollup.config.mjs | 2 +- src/core/reconciler.ts | 2 +- tsconfig.eslint.json | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/rollup.config.mjs b/rollup.config.mjs index faaf26cb..86af9ace 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -1,7 +1,7 @@ import path from 'node:path'; import esbuild from 'rollup-plugin-esbuild'; import sourcemaps from 'rollup-plugin-sourcemaps'; -import repo from './package.json' assert { type: 'json' }; +import repo from './package.json' with { type: 'json' }; import commonjs from '@rollup/plugin-commonjs'; import json from '@rollup/plugin-json'; import resolve from '@rollup/plugin-node-resolve'; diff --git a/src/core/reconciler.ts b/src/core/reconciler.ts index f2709970..37a52dd2 100644 --- a/src/core/reconciler.ts +++ b/src/core/reconciler.ts @@ -1,7 +1,7 @@ /* eslint-disable no-empty-function */ import Reconciler from 'react-reconciler'; -import packageData from '../../package.json' assert { type: 'json' }; +import packageData from '../../package.json' with { type: 'json' }; import { afterActiveInstanceBlur } from '../helpers/afterActiveInstanceBlur'; import { appendChild } from '../helpers/appendChild'; import { beforeActiveInstanceBlur } from '../helpers/beforeActiveInstanceBlur'; diff --git a/tsconfig.eslint.json b/tsconfig.eslint.json index e5818db1..7e3f163c 100644 --- a/tsconfig.eslint.json +++ b/tsconfig.eslint.json @@ -3,6 +3,7 @@ "files": [ ".eslintrc.js", "release.config.js", + "rollup.config.mjs", ], "include": [ "./lib/**/*", From 95197dd6aa4df83719a56f1e9d9bd954b33c6bfd Mon Sep 17 00:00:00 2001 From: Trezy Date: Wed, 25 Dec 2024 23:02:03 -0600 Subject: [PATCH 18/19] build: remove unused dep Signed-off-by: Trezy --- package-lock.json | 97 ++++++++++++++++++++++++++++++++++++++++------- package.json | 1 - 2 files changed, 83 insertions(+), 15 deletions(-) diff --git a/package-lock.json b/package-lock.json index f79dce6a..df71862e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,7 +24,6 @@ "@types/react-reconciler": "0.28.8", "@vitejs/plugin-react": "^4.3.1", "@vitest/browser": "^2.0.4", - "canvas": "^2.11.2", "husky": "^8.0.0", "jsdom": "^25.0.0", "pixi.js": "8.2.6", @@ -2640,6 +2639,8 @@ "integrity": "sha512-Yhlar6v9WQgUp/He7BdgzOz8lqMQ8sU+jkCq7Wx8Myc5YFJLbEe7lgui/V7G1qB1DJykHSGwreceSaD60Y0PUQ==", "dev": true, "license": "BSD-3-Clause", + "optional": true, + "peer": true, "dependencies": { "detect-libc": "^2.0.0", "https-proxy-agent": "^5.0.0", @@ -2661,6 +2662,8 @@ "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", "dev": true, "license": "ISC", + "optional": true, + "peer": true, "bin": { "semver": "bin/semver.js" }, @@ -5768,7 +5771,9 @@ "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", "dev": true, - "license": "ISC" + "license": "ISC", + "optional": true, + "peer": true }, "node_modules/acorn": { "version": "8.12.1", @@ -5881,7 +5886,9 @@ "resolved": "https://registry.npmjs.org/aproba/-/aproba-2.0.0.tgz", "integrity": "sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==", "dev": true, - "license": "ISC" + "license": "ISC", + "optional": true, + "peer": true }, "node_modules/are-we-there-yet": { "version": "2.0.0", @@ -5890,6 +5897,8 @@ "deprecated": "This package is no longer supported.", "dev": true, "license": "ISC", + "optional": true, + "peer": true, "dependencies": { "delegates": "^1.0.0", "readable-stream": "^3.6.0" @@ -5904,6 +5913,8 @@ "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", @@ -5932,7 +5943,9 @@ "url": "https://feross.org/support" } ], - "license": "MIT" + "license": "MIT", + "optional": true, + "peer": true }, "node_modules/are-we-there-yet/node_modules/string_decoder": { "version": "1.3.0", @@ -5940,6 +5953,8 @@ "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "safe-buffer": "~5.2.0" } @@ -6797,6 +6812,8 @@ "dev": true, "hasInstallScript": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "@mapbox/node-pre-gyp": "^1.0.0", "nan": "^2.17.0", @@ -6882,6 +6899,8 @@ "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", "dev": true, "license": "ISC", + "optional": true, + "peer": true, "engines": { "node": ">=10" } @@ -7156,6 +7175,8 @@ "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==", "dev": true, "license": "ISC", + "optional": true, + "peer": true, "bin": { "color-support": "bin.js" } @@ -7227,7 +7248,9 @@ "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", "integrity": "sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==", "dev": true, - "license": "ISC" + "license": "ISC", + "optional": true, + "peer": true }, "node_modules/convert-source-map": { "version": "2.0.0", @@ -7776,7 +7799,9 @@ "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", "integrity": "sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==", "dev": true, - "license": "MIT" + "license": "MIT", + "optional": true, + "peer": true }, "node_modules/dequal": { "version": "2.0.3", @@ -7805,6 +7830,8 @@ "integrity": "sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw==", "dev": true, "license": "Apache-2.0", + "optional": true, + "peer": true, "engines": { "node": ">=8" } @@ -9688,6 +9715,8 @@ "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", "dev": true, "license": "ISC", + "optional": true, + "peer": true, "dependencies": { "minipass": "^3.0.0" }, @@ -9701,6 +9730,8 @@ "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", "dev": true, "license": "ISC", + "optional": true, + "peer": true, "dependencies": { "yallist": "^4.0.0" }, @@ -9713,7 +9744,9 @@ "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", "dev": true, - "license": "ISC" + "license": "ISC", + "optional": true, + "peer": true }, "node_modules/fs.realpath": { "version": "1.0.0", @@ -9783,6 +9816,8 @@ "deprecated": "This package is no longer supported.", "dev": true, "license": "ISC", + "optional": true, + "peer": true, "dependencies": { "aproba": "^1.0.3 || ^2.0.0", "color-support": "^1.1.2", @@ -9803,7 +9838,9 @@ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "dev": true, - "license": "ISC" + "license": "ISC", + "optional": true, + "peer": true }, "node_modules/gensync": { "version": "1.0.0-beta.2", @@ -10401,7 +10438,9 @@ "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", "integrity": "sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==", "dev": true, - "license": "ISC" + "license": "ISC", + "optional": true, + "peer": true }, "node_modules/has-value": { "version": "1.0.0", @@ -14612,6 +14651,8 @@ "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "minipass": "^3.0.0", "yallist": "^4.0.0" @@ -14626,6 +14667,8 @@ "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", "dev": true, "license": "ISC", + "optional": true, + "peer": true, "dependencies": { "yallist": "^4.0.0" }, @@ -14638,7 +14681,9 @@ "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", "dev": true, - "license": "ISC" + "license": "ISC", + "optional": true, + "peer": true }, "node_modules/missionlog": { "version": "1.8.8", @@ -14879,7 +14924,9 @@ "resolved": "https://registry.npmjs.org/nan/-/nan-2.20.0.tgz", "integrity": "sha512-bk3gXBZDGILuuo/6sKtr0DQmSThYHLtNCdSdXk9YkxD/jK6X2vmCyyXBBxyqZ4XcnzTyYEAThfX3DCEnLf6igw==", "dev": true, - "license": "MIT" + "license": "MIT", + "optional": true, + "peer": true }, "node_modules/nanoid": { "version": "3.1.32", @@ -14993,6 +15040,8 @@ "integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==", "dev": true, "license": "ISC", + "optional": true, + "peer": true, "dependencies": { "abbrev": "1" }, @@ -15069,6 +15118,8 @@ "deprecated": "This package is no longer supported.", "dev": true, "license": "ISC", + "optional": true, + "peer": true, "dependencies": { "are-we-there-yet": "^2.0.0", "console-control-strings": "^1.1.0", @@ -17044,7 +17095,9 @@ "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==", "dev": true, - "license": "ISC" + "license": "ISC", + "optional": true, + "peer": true }, "node_modules/set-function-length": { "version": "1.2.2", @@ -17213,7 +17266,9 @@ "url": "https://feross.org/support" } ], - "license": "MIT" + "license": "MIT", + "optional": true, + "peer": true }, "node_modules/simple-get": { "version": "3.1.1", @@ -17221,6 +17276,8 @@ "integrity": "sha512-CQ5LTKGfCpvE1K0n2us+kuMPbk/q0EKl82s4aheV9oXjFEz6W/Y7oQFVJuU6QG77hRT4Ghb5RURteF5vnWjupA==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "decompress-response": "^4.2.0", "once": "^1.3.1", @@ -17233,6 +17290,8 @@ "integrity": "sha512-jOSne2qbyE+/r8G1VU+G/82LBs2Fs4LAsTiLSHOCOMZQl2OKZ6i8i4IyHemTe+/yIXOtTcRQMzPcgyhoFlqPkw==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "mimic-response": "^2.0.0" }, @@ -17246,6 +17305,8 @@ "integrity": "sha512-wXqjST+SLt7R009ySCglWBCFpjUygmCIfD790/kVbiGmUgfYGuB14PiTd5DwVxSV4NcYHjzMkoj5LjQZwTQLEA==", "dev": true, "license": "MIT", + "optional": true, + "peer": true, "engines": { "node": ">=8" }, @@ -18054,6 +18115,8 @@ "integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==", "dev": true, "license": "ISC", + "optional": true, + "peer": true, "dependencies": { "chownr": "^2.0.0", "fs-minipass": "^2.0.0", @@ -18135,6 +18198,8 @@ "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", "dev": true, "license": "ISC", + "optional": true, + "peer": true, "engines": { "node": ">=8" } @@ -18144,7 +18209,9 @@ "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", "dev": true, - "license": "ISC" + "license": "ISC", + "optional": true, + "peer": true }, "node_modules/test-exclude": { "version": "6.0.0", @@ -19880,6 +19947,8 @@ "integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==", "dev": true, "license": "ISC", + "optional": true, + "peer": true, "dependencies": { "string-width": "^1.0.2 || 2 || 3 || 4" } diff --git a/package.json b/package.json index 551ef93b..44beb5ce 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,6 @@ "@types/react-reconciler": "0.28.8", "@vitejs/plugin-react": "^4.3.1", "@vitest/browser": "^2.0.4", - "canvas": "^2.11.2", "husky": "^8.0.0", "jsdom": "^25.0.0", "pixi.js": "8.2.6", From 4fc621b123226738b7fa7c68b0211c67b9085631 Mon Sep 17 00:00:00 2001 From: Trezy Date: Wed, 25 Dec 2024 23:07:59 -0600 Subject: [PATCH 19/19] ci: disable bin rebuild Signed-off-by: Trezy --- .github/actions/setup/action.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index e1383f22..7d997969 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -29,7 +29,7 @@ runs: shell: bash run: npm ci --ignore-scripts --no-audit --no-fund - - name: Rebuild binaries - if: steps.node-modules-cache.outputs.cache-hit != 'true' - shell: bash - run: npm rebuild + # - name: Rebuild binaries + # if: steps.node-modules-cache.outputs.cache-hit != 'true' + # shell: bash + # run: npm rebuild