From a2f17b19ecdbe8606d3b225348232df846cc2f65 Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Fri, 6 Dec 2024 14:46:03 +0800 Subject: [PATCH 01/18] feat(client): add `onContentUpdated` hooks --- packages/client/src/components/Content.ts | 9 ++++++-- .../client/src/composables/contentUpdated.ts | 21 +++++++++++++++++++ packages/client/src/composables/index.ts | 1 + 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 packages/client/src/composables/contentUpdated.ts diff --git a/packages/client/src/components/Content.ts b/packages/client/src/components/Content.ts index e58b46214d..41fb0fdc7b 100644 --- a/packages/client/src/components/Content.ts +++ b/packages/client/src/components/Content.ts @@ -1,5 +1,5 @@ import { computed, defineAsyncComponent, defineComponent, h } from 'vue' -import { usePageComponent } from '../composables/index.js' +import { runCallbacks, usePageComponent } from '../composables/index.js' import { resolveRoute } from '../router/index.js' /** @@ -26,6 +26,11 @@ export const Content = defineComponent({ ) }) - return () => h(ContentComponent.value) + return () => + h(ContentComponent.value, { + onVnodeMounted: runCallbacks, + onVnodeUpdated: runCallbacks, + onVnodeBeforeUnmount: runCallbacks, + }) }, }) diff --git a/packages/client/src/composables/contentUpdated.ts b/packages/client/src/composables/contentUpdated.ts new file mode 100644 index 0000000000..1b495719ac --- /dev/null +++ b/packages/client/src/composables/contentUpdated.ts @@ -0,0 +1,21 @@ +import { onUnmounted } from 'vue' + +let contentUpdatedCallbacks: (() => unknown)[] = [] + +/** + * Register callback that is called every time the markdown content is updated + * in the DOM. + */ +export const onContentUpdated = (fn: () => unknown): void => { + contentUpdatedCallbacks.push(fn) + onUnmounted(() => { + contentUpdatedCallbacks = contentUpdatedCallbacks.filter((f) => f !== fn) + }) +} + +/** + * Call all registered callbacks + */ +export const runCallbacks = (): void => { + contentUpdatedCallbacks.forEach((fn) => fn()) +} diff --git a/packages/client/src/composables/index.ts b/packages/client/src/composables/index.ts index c834060742..290b3b41cf 100644 --- a/packages/client/src/composables/index.ts +++ b/packages/client/src/composables/index.ts @@ -1,3 +1,4 @@ export * from './clientData.js' export * from './clientDataUtils.js' export * from './updateHead.js' +export * from './contentUpdated.js' From ee7a5ca41d5ef1062cd0a6d6ff470dfb81034bcd Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Fri, 13 Dec 2024 00:46:16 +0800 Subject: [PATCH 02/18] chore: tweak --- packages/client/src/components/Content.ts | 12 +++++-- .../client/src/composables/contentHooks.ts | 31 +++++++++++++++++++ .../client/src/composables/contentUpdated.ts | 21 ------------- packages/client/src/composables/index.ts | 2 +- 4 files changed, 41 insertions(+), 25 deletions(-) create mode 100644 packages/client/src/composables/contentHooks.ts delete mode 100644 packages/client/src/composables/contentUpdated.ts diff --git a/packages/client/src/components/Content.ts b/packages/client/src/components/Content.ts index 41fb0fdc7b..59f7665976 100644 --- a/packages/client/src/components/Content.ts +++ b/packages/client/src/components/Content.ts @@ -28,9 +28,15 @@ export const Content = defineComponent({ return () => h(ContentComponent.value, { - onVnodeMounted: runCallbacks, - onVnodeUpdated: runCallbacks, - onVnodeBeforeUnmount: runCallbacks, + onVnodeMounted: () => { + runCallbacks('mounted') + }, + onVnodeUpdated: () => { + runCallbacks('change') + }, + onVnodeBeforeUnmount: () => { + runCallbacks('beforeUnmount') + }, }) }, }) diff --git a/packages/client/src/composables/contentHooks.ts b/packages/client/src/composables/contentHooks.ts new file mode 100644 index 0000000000..dbc1fb3180 --- /dev/null +++ b/packages/client/src/composables/contentHooks.ts @@ -0,0 +1,31 @@ +import { onUnmounted } from 'vue' + +type LifeCycle = 'beforeUnmount' | 'change' | 'mounted' + +const hooks: Record unknown)[]> = { + mounted: [], + beforeUnmount: [], + change: [], +} + +const createHook = + (lifeCycle: LifeCycle) => + (fn: () => unknown): void => { + hooks[lifeCycle].push(fn) + onUnmounted(() => { + hooks[lifeCycle] = hooks[lifeCycle].filter((f) => f !== fn) + }) + } + +export const onContentChange = createHook('change') + +export const onContentMounted = createHook('mounted') + +export const onContentBeforeUnmount = createHook('beforeUnmount') + +/** + * Call all registered callbacks + */ +export const runCallbacks = (lifeCycle: LifeCycle): void => { + hooks[lifeCycle].forEach((fn) => fn()) +} diff --git a/packages/client/src/composables/contentUpdated.ts b/packages/client/src/composables/contentUpdated.ts deleted file mode 100644 index 1b495719ac..0000000000 --- a/packages/client/src/composables/contentUpdated.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { onUnmounted } from 'vue' - -let contentUpdatedCallbacks: (() => unknown)[] = [] - -/** - * Register callback that is called every time the markdown content is updated - * in the DOM. - */ -export const onContentUpdated = (fn: () => unknown): void => { - contentUpdatedCallbacks.push(fn) - onUnmounted(() => { - contentUpdatedCallbacks = contentUpdatedCallbacks.filter((f) => f !== fn) - }) -} - -/** - * Call all registered callbacks - */ -export const runCallbacks = (): void => { - contentUpdatedCallbacks.forEach((fn) => fn()) -} diff --git a/packages/client/src/composables/index.ts b/packages/client/src/composables/index.ts index 290b3b41cf..aa34aa20bb 100644 --- a/packages/client/src/composables/index.ts +++ b/packages/client/src/composables/index.ts @@ -1,4 +1,4 @@ export * from './clientData.js' export * from './clientDataUtils.js' export * from './updateHead.js' -export * from './contentUpdated.js' +export * from './contentHooks.js' From 14f8b467311dc2ff2f3e936602ffaa53468ecae3 Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Fri, 13 Dec 2024 10:01:44 +0800 Subject: [PATCH 03/18] test: add e2e test --- .../components/MarkdownContentHooks.vue | 46 ++++++++++++ .../.vuepress/theme/client/layouts/Layout.vue | 3 + e2e/docs/content-hooks/content.md | 3 + e2e/tests/content-hooks.spec.ts | 70 +++++++++++++++++++ 4 files changed, 122 insertions(+) create mode 100644 e2e/docs/.vuepress/theme/client/components/MarkdownContentHooks.vue create mode 100644 e2e/docs/content-hooks/content.md create mode 100644 e2e/tests/content-hooks.spec.ts diff --git a/e2e/docs/.vuepress/theme/client/components/MarkdownContentHooks.vue b/e2e/docs/.vuepress/theme/client/components/MarkdownContentHooks.vue new file mode 100644 index 0000000000..1426d7d702 --- /dev/null +++ b/e2e/docs/.vuepress/theme/client/components/MarkdownContentHooks.vue @@ -0,0 +1,46 @@ + + + diff --git a/e2e/docs/.vuepress/theme/client/layouts/Layout.vue b/e2e/docs/.vuepress/theme/client/layouts/Layout.vue index 07519db48d..7888e994aa 100644 --- a/e2e/docs/.vuepress/theme/client/layouts/Layout.vue +++ b/e2e/docs/.vuepress/theme/client/layouts/Layout.vue @@ -1,5 +1,6 @@ @@ -18,6 +19,8 @@ const siteData = useSiteData()
+ + diff --git a/e2e/docs/content-hooks/content.md b/e2e/docs/content-hooks/content.md new file mode 100644 index 0000000000..a8badd3c11 --- /dev/null +++ b/e2e/docs/content-hooks/content.md @@ -0,0 +1,3 @@ +## title + +content diff --git a/e2e/tests/content-hooks.spec.ts b/e2e/tests/content-hooks.spec.ts new file mode 100644 index 0000000000..c960a0f8cd --- /dev/null +++ b/e2e/tests/content-hooks.spec.ts @@ -0,0 +1,70 @@ +import { expect, test } from '@playwright/test' +import { IS_DEV } from '../utils/env' +import { readSourceMarkdown, writeSourceMarkdown } from '../utils/source' + +let changeCount = 0 + +const updateMarkdownContent = async (): Promise => { + changeCount++ + const content = await readSourceMarkdown('content-hooks/content.md') + await writeSourceMarkdown( + 'content-hooks/content.md', + `${content}\n\nUpdated content`, + ) +} + +const restoreMarkdownContent = async (): Promise => { + changeCount = 0 + await writeSourceMarkdown('content-hooks/content.md', '## title\n\ncontent\n') +} + +if (IS_DEV) { + test.beforeEach(async () => { + await restoreMarkdownContent() + }) + test.afterEach(async () => { + await restoreMarkdownContent() + }) +} + +test('should call content mounted hook', async ({ page }) => { + const mountedLocator = page.locator( + '.markdown-content-hooks .markdown-content-mounted', + ) + await page.goto('content-hooks/content.html') + + await expect(mountedLocator).toHaveText( + 'mounted: /content-hooks/content.html 1', + ) + + // update content but mounted hook should not be called twice + await updateMarkdownContent() + await expect(mountedLocator).toHaveText( + 'mounted: /content-hooks/content.html 1', + ) +}) + +test('should call content change hook', async ({ page }) => { + const changeLocator = page.locator( + '.markdown-content-hooks .markdown-content-change', + ) + await page.goto('content-hooks/content.html') + + await updateMarkdownContent() + await expect(changeLocator).toHaveText(`changedCount: ${changeCount}`) // 1 + + await updateMarkdownContent() + await expect(changeLocator).toHaveText(`changedCount: ${changeCount}`) // 2 +}) + +test('should call content before unmount hook', async ({ page }) => { + const beforeUnmountLocator = page.locator( + '.markdown-content-hooks .markdown-content-before-unmount', + ) + await page.goto('content-hooks/content.html') + await page.locator('.e2e-theme-nav a[href="/"]').click() + + await expect(beforeUnmountLocator).toHaveText( + 'beforeUnmount: /content-hooks/content.html', + ) +}) From 7289707d586e2e4706aa7217d9031aa219fcf365 Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Fri, 13 Dec 2024 10:16:59 +0800 Subject: [PATCH 04/18] test: update e2e test --- e2e/tests/content-hooks.spec.ts | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/e2e/tests/content-hooks.spec.ts b/e2e/tests/content-hooks.spec.ts index c960a0f8cd..50a43e1c2c 100644 --- a/e2e/tests/content-hooks.spec.ts +++ b/e2e/tests/content-hooks.spec.ts @@ -18,14 +18,12 @@ const restoreMarkdownContent = async (): Promise => { await writeSourceMarkdown('content-hooks/content.md', '## title\n\ncontent\n') } -if (IS_DEV) { - test.beforeEach(async () => { - await restoreMarkdownContent() - }) - test.afterEach(async () => { - await restoreMarkdownContent() - }) -} +test.beforeEach(async () => { + await restoreMarkdownContent() +}) +test.afterAll(async () => { + await restoreMarkdownContent() +}) test('should call content mounted hook', async ({ page }) => { const mountedLocator = page.locator( @@ -44,6 +42,9 @@ test('should call content mounted hook', async ({ page }) => { ) }) +/** + * onContentChange hook should only called in development + */ test('should call content change hook', async ({ page }) => { const changeLocator = page.locator( '.markdown-content-hooks .markdown-content-change', @@ -51,10 +52,14 @@ test('should call content change hook', async ({ page }) => { await page.goto('content-hooks/content.html') await updateMarkdownContent() - await expect(changeLocator).toHaveText(`changedCount: ${changeCount}`) // 1 + await expect(changeLocator).toHaveText( + `changedCount: ${IS_DEV ? changeCount : 0}`, + ) // 1 await updateMarkdownContent() - await expect(changeLocator).toHaveText(`changedCount: ${changeCount}`) // 2 + await expect(changeLocator).toHaveText( + `changedCount: ${IS_DEV ? changeCount : 0}`, + ) // 2 }) test('should call content before unmount hook', async ({ page }) => { From 784a1fcf9fcb0136669a2aff44495968ef43b76e Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Fri, 13 Dec 2024 10:47:50 +0800 Subject: [PATCH 05/18] chore: tweak --- e2e/tests/content-hooks.spec.ts | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/e2e/tests/content-hooks.spec.ts b/e2e/tests/content-hooks.spec.ts index 50a43e1c2c..7e96cb3d07 100644 --- a/e2e/tests/content-hooks.spec.ts +++ b/e2e/tests/content-hooks.spec.ts @@ -2,10 +2,7 @@ import { expect, test } from '@playwright/test' import { IS_DEV } from '../utils/env' import { readSourceMarkdown, writeSourceMarkdown } from '../utils/source' -let changeCount = 0 - const updateMarkdownContent = async (): Promise => { - changeCount++ const content = await readSourceMarkdown('content-hooks/content.md') await writeSourceMarkdown( 'content-hooks/content.md', @@ -14,14 +11,13 @@ const updateMarkdownContent = async (): Promise => { } const restoreMarkdownContent = async (): Promise => { - changeCount = 0 await writeSourceMarkdown('content-hooks/content.md', '## title\n\ncontent\n') } test.beforeEach(async () => { await restoreMarkdownContent() }) -test.afterAll(async () => { +test.afterEach(async () => { await restoreMarkdownContent() }) @@ -52,14 +48,10 @@ test('should call content change hook', async ({ page }) => { await page.goto('content-hooks/content.html') await updateMarkdownContent() - await expect(changeLocator).toHaveText( - `changedCount: ${IS_DEV ? changeCount : 0}`, - ) // 1 + await expect(changeLocator).toHaveText(`changedCount: ${IS_DEV ? 1 : 0}`) // 1 await updateMarkdownContent() - await expect(changeLocator).toHaveText( - `changedCount: ${IS_DEV ? changeCount : 0}`, - ) // 2 + await expect(changeLocator).toHaveText(`changedCount: ${IS_DEV ? 2 : 0}`) // 2 }) test('should call content before unmount hook', async ({ page }) => { From 8c366e13c4764a4c7ccfada508d1702ad9761250 Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Fri, 13 Dec 2024 11:02:44 +0800 Subject: [PATCH 06/18] chore: tweak --- e2e/tests/content-hooks.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/tests/content-hooks.spec.ts b/e2e/tests/content-hooks.spec.ts index 7e96cb3d07..2d1e1d594f 100644 --- a/e2e/tests/content-hooks.spec.ts +++ b/e2e/tests/content-hooks.spec.ts @@ -17,7 +17,7 @@ const restoreMarkdownContent = async (): Promise => { test.beforeEach(async () => { await restoreMarkdownContent() }) -test.afterEach(async () => { +test.afterAll(async () => { await restoreMarkdownContent() }) From 236ca9864f177400a1b52c9c031f82c67669021d Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Fri, 13 Dec 2024 11:04:58 +0800 Subject: [PATCH 07/18] chore: tweak --- e2e/tests/content-hooks.spec.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/e2e/tests/content-hooks.spec.ts b/e2e/tests/content-hooks.spec.ts index 2d1e1d594f..cff9a76c35 100644 --- a/e2e/tests/content-hooks.spec.ts +++ b/e2e/tests/content-hooks.spec.ts @@ -14,9 +14,6 @@ const restoreMarkdownContent = async (): Promise => { await writeSourceMarkdown('content-hooks/content.md', '## title\n\ncontent\n') } -test.beforeEach(async () => { - await restoreMarkdownContent() -}) test.afterAll(async () => { await restoreMarkdownContent() }) From 7aef1739ea3ace46ae694d775f8bf1ca00d939b5 Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Fri, 13 Dec 2024 11:17:59 +0800 Subject: [PATCH 08/18] chore: tweak --- e2e/tests/content-hooks.spec.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/e2e/tests/content-hooks.spec.ts b/e2e/tests/content-hooks.spec.ts index cff9a76c35..3227d051e7 100644 --- a/e2e/tests/content-hooks.spec.ts +++ b/e2e/tests/content-hooks.spec.ts @@ -27,18 +27,15 @@ test('should call content mounted hook', async ({ page }) => { await expect(mountedLocator).toHaveText( 'mounted: /content-hooks/content.html 1', ) - - // update content but mounted hook should not be called twice - await updateMarkdownContent() - await expect(mountedLocator).toHaveText( - 'mounted: /content-hooks/content.html 1', - ) }) /** * onContentChange hook should only called in development */ test('should call content change hook', async ({ page }) => { + const mountedLocator = page.locator( + '.markdown-content-hooks .markdown-content-mounted', + ) const changeLocator = page.locator( '.markdown-content-hooks .markdown-content-change', ) @@ -49,6 +46,11 @@ test('should call content change hook', async ({ page }) => { await updateMarkdownContent() await expect(changeLocator).toHaveText(`changedCount: ${IS_DEV ? 2 : 0}`) // 2 + + // update content but mounted hook should not be called twice + await expect(mountedLocator).toHaveText( + 'mounted: /content-hooks/content.html 1', + ) }) test('should call content before unmount hook', async ({ page }) => { @@ -56,7 +58,7 @@ test('should call content before unmount hook', async ({ page }) => { '.markdown-content-hooks .markdown-content-before-unmount', ) await page.goto('content-hooks/content.html') - await page.locator('.e2e-theme-nav a[href="/"]').click() + await page.locator('.e2e-theme-nav ul > li > a').nth(0).click() await expect(beforeUnmountLocator).toHaveText( 'beforeUnmount: /content-hooks/content.html', From c443341aa2c9b008b4cfe9213ec152a88f3470a1 Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Fri, 13 Dec 2024 11:21:21 +0800 Subject: [PATCH 09/18] chore: tweak --- e2e/tests/content-hooks.spec.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/e2e/tests/content-hooks.spec.ts b/e2e/tests/content-hooks.spec.ts index 3227d051e7..fdecd3928c 100644 --- a/e2e/tests/content-hooks.spec.ts +++ b/e2e/tests/content-hooks.spec.ts @@ -27,15 +27,18 @@ test('should call content mounted hook', async ({ page }) => { await expect(mountedLocator).toHaveText( 'mounted: /content-hooks/content.html 1', ) + + // update content but mounted hook should not be called twice + await updateMarkdownContent() + await expect(mountedLocator).toHaveText( + 'mounted: /content-hooks/content.html 1', + ) }) /** * onContentChange hook should only called in development */ test('should call content change hook', async ({ page }) => { - const mountedLocator = page.locator( - '.markdown-content-hooks .markdown-content-mounted', - ) const changeLocator = page.locator( '.markdown-content-hooks .markdown-content-change', ) @@ -46,11 +49,6 @@ test('should call content change hook', async ({ page }) => { await updateMarkdownContent() await expect(changeLocator).toHaveText(`changedCount: ${IS_DEV ? 2 : 0}`) // 2 - - // update content but mounted hook should not be called twice - await expect(mountedLocator).toHaveText( - 'mounted: /content-hooks/content.html 1', - ) }) test('should call content before unmount hook', async ({ page }) => { From da8b23851277f4212b714a92b07bc3325cefb033 Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Thu, 20 Feb 2025 23:57:02 +0800 Subject: [PATCH 10/18] chore: tweak --- .../components/MarkdownContentHooks.vue | 41 +++++++++---------- e2e/tests/content-hooks.spec.ts | 29 +++++++------ package.json | 8 +++- packages/client/src/components/Content.ts | 19 +++++++-- .../client/src/composables/contentHooks.ts | 38 +++++++---------- 5 files changed, 71 insertions(+), 64 deletions(-) diff --git a/e2e/docs/.vuepress/theme/client/components/MarkdownContentHooks.vue b/e2e/docs/.vuepress/theme/client/components/MarkdownContentHooks.vue index 1426d7d702..29587458aa 100644 --- a/e2e/docs/.vuepress/theme/client/components/MarkdownContentHooks.vue +++ b/e2e/docs/.vuepress/theme/client/components/MarkdownContentHooks.vue @@ -1,46 +1,45 @@ diff --git a/e2e/tests/content-hooks.spec.ts b/e2e/tests/content-hooks.spec.ts index fdecd3928c..364967e346 100644 --- a/e2e/tests/content-hooks.spec.ts +++ b/e2e/tests/content-hooks.spec.ts @@ -18,12 +18,11 @@ test.afterAll(async () => { await restoreMarkdownContent() }) -test('should call content mounted hook', async ({ page }) => { +test('should call content hook on mounted', async ({ page }) => { + await page.goto('content-hooks/content.html') const mountedLocator = page.locator( '.markdown-content-hooks .markdown-content-mounted', ) - await page.goto('content-hooks/content.html') - await expect(mountedLocator).toHaveText( 'mounted: /content-hooks/content.html 1', ) @@ -38,27 +37,27 @@ test('should call content mounted hook', async ({ page }) => { /** * onContentChange hook should only called in development */ -test('should call content change hook', async ({ page }) => { - const changeLocator = page.locator( - '.markdown-content-hooks .markdown-content-change', - ) +test('should call content hook on updated', async ({ page }) => { await page.goto('content-hooks/content.html') + const updatedLocator = page.locator( + '.markdown-content-hooks .markdown-content-updated', + ) await updateMarkdownContent() - await expect(changeLocator).toHaveText(`changedCount: ${IS_DEV ? 1 : 0}`) // 1 + await expect(updatedLocator).toHaveText(`updatedCount: ${IS_DEV ? 1 : 0}`) // 1 await updateMarkdownContent() - await expect(changeLocator).toHaveText(`changedCount: ${IS_DEV ? 2 : 0}`) // 2 + await expect(updatedLocator).toHaveText(`updatedCount: ${IS_DEV ? 2 : 0}`) // 2 }) -test('should call content before unmount hook', async ({ page }) => { +test('should call content hook on beforeUnmount', async ({ page }) => { + await page.goto('content-hooks/content.html') + const beforeUnmountLocator = page.locator( - '.markdown-content-hooks .markdown-content-before-unmount', + '.markdown-content-hooks .markdown-content-beforeUnmount', ) - await page.goto('content-hooks/content.html') + await page.locator('.e2e-theme-nav ul > li > a').nth(0).click() - await expect(beforeUnmountLocator).toHaveText( - 'beforeUnmount: /content-hooks/content.html', - ) + await expect(beforeUnmountLocator).toHaveText('beforeUnmount: /') }) diff --git a/package.json b/package.json index eb8cf472b3..099a324eb3 100644 --- a/package.json +++ b/package.json @@ -57,5 +57,11 @@ "vitest": "^3.0.6", "vue-tsc": "^2.2.2" }, - "packageManager": "pnpm@10.4.1" + "packageManager": "pnpm@10.4.1", + "pnpm": { + "onlyBuiltDependencies": [ + "@parcel/watcher", + "esbuild" + ] + } } diff --git a/packages/client/src/components/Content.ts b/packages/client/src/components/Content.ts index 59f7665976..44fb925203 100644 --- a/packages/client/src/components/Content.ts +++ b/packages/client/src/components/Content.ts @@ -1,5 +1,9 @@ -import { computed, defineAsyncComponent, defineComponent, h } from 'vue' -import { runCallbacks, usePageComponent } from '../composables/index.js' +import { computed, defineAsyncComponent, defineComponent, h, watch } from 'vue' +import { + runCallbacks, + usePageComponent, + usePageFrontmatter, +} from '../composables/index.js' import { resolveRoute } from '../router/index.js' /** @@ -26,13 +30,22 @@ export const Content = defineComponent({ ) }) + const frontmatter = usePageFrontmatter() + watch( + frontmatter, + () => { + runCallbacks('updated') + }, + { deep: true, flush: 'post' }, + ) + return () => h(ContentComponent.value, { onVnodeMounted: () => { runCallbacks('mounted') }, onVnodeUpdated: () => { - runCallbacks('change') + runCallbacks('updated') }, onVnodeBeforeUnmount: () => { runCallbacks('beforeUnmount') diff --git a/packages/client/src/composables/contentHooks.ts b/packages/client/src/composables/contentHooks.ts index dbc1fb3180..7ec660c8e8 100644 --- a/packages/client/src/composables/contentHooks.ts +++ b/packages/client/src/composables/contentHooks.ts @@ -1,31 +1,21 @@ import { onUnmounted } from 'vue' -type LifeCycle = 'beforeUnmount' | 'change' | 'mounted' +type ContentUpdatedReason = 'beforeUnmount' | 'mounted' | 'updated' +type ContentUpdatedCallback = (reason: ContentUpdatedReason) => unknown -const hooks: Record unknown)[]> = { - mounted: [], - beforeUnmount: [], - change: [], -} - -const createHook = - (lifeCycle: LifeCycle) => - (fn: () => unknown): void => { - hooks[lifeCycle].push(fn) - onUnmounted(() => { - hooks[lifeCycle] = hooks[lifeCycle].filter((f) => f !== fn) - }) - } - -export const onContentChange = createHook('change') - -export const onContentMounted = createHook('mounted') - -export const onContentBeforeUnmount = createHook('beforeUnmount') +let contentUpdatedCallbacks: ContentUpdatedCallback[] = [] /** - * Call all registered callbacks + * Register callback that is called every time the markdown content is updated + * in the DOM. */ -export const runCallbacks = (lifeCycle: LifeCycle): void => { - hooks[lifeCycle].forEach((fn) => fn()) +export const onContentUpdated = (fn: ContentUpdatedCallback): void => { + contentUpdatedCallbacks.push(fn) + onUnmounted(() => { + contentUpdatedCallbacks = contentUpdatedCallbacks.filter((f) => f !== fn) + }) +} + +export function runCallbacks(reason: ContentUpdatedReason): void { + contentUpdatedCallbacks.forEach((fn) => fn(reason)) } From 41bcccc1589f0b4842c488b419c7a5784151d27b Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Fri, 21 Feb 2025 00:11:52 +0800 Subject: [PATCH 11/18] chore: tweak --- e2e/tests/content-hooks.spec.ts | 63 ------------------ e2e/tests/on-content-updated.spec.ts | 65 +++++++++++++++++++ .../{contentHooks.ts => onContentUpdated.ts} | 0 3 files changed, 65 insertions(+), 63 deletions(-) delete mode 100644 e2e/tests/content-hooks.spec.ts create mode 100644 e2e/tests/on-content-updated.spec.ts rename packages/client/src/composables/{contentHooks.ts => onContentUpdated.ts} (100%) diff --git a/e2e/tests/content-hooks.spec.ts b/e2e/tests/content-hooks.spec.ts deleted file mode 100644 index 364967e346..0000000000 --- a/e2e/tests/content-hooks.spec.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { expect, test } from '@playwright/test' -import { IS_DEV } from '../utils/env' -import { readSourceMarkdown, writeSourceMarkdown } from '../utils/source' - -const updateMarkdownContent = async (): Promise => { - const content = await readSourceMarkdown('content-hooks/content.md') - await writeSourceMarkdown( - 'content-hooks/content.md', - `${content}\n\nUpdated content`, - ) -} - -const restoreMarkdownContent = async (): Promise => { - await writeSourceMarkdown('content-hooks/content.md', '## title\n\ncontent\n') -} - -test.afterAll(async () => { - await restoreMarkdownContent() -}) - -test('should call content hook on mounted', async ({ page }) => { - await page.goto('content-hooks/content.html') - const mountedLocator = page.locator( - '.markdown-content-hooks .markdown-content-mounted', - ) - await expect(mountedLocator).toHaveText( - 'mounted: /content-hooks/content.html 1', - ) - - // update content but mounted hook should not be called twice - await updateMarkdownContent() - await expect(mountedLocator).toHaveText( - 'mounted: /content-hooks/content.html 1', - ) -}) - -/** - * onContentChange hook should only called in development - */ -test('should call content hook on updated', async ({ page }) => { - await page.goto('content-hooks/content.html') - const updatedLocator = page.locator( - '.markdown-content-hooks .markdown-content-updated', - ) - - await updateMarkdownContent() - await expect(updatedLocator).toHaveText(`updatedCount: ${IS_DEV ? 1 : 0}`) // 1 - - await updateMarkdownContent() - await expect(updatedLocator).toHaveText(`updatedCount: ${IS_DEV ? 2 : 0}`) // 2 -}) - -test('should call content hook on beforeUnmount', async ({ page }) => { - await page.goto('content-hooks/content.html') - - const beforeUnmountLocator = page.locator( - '.markdown-content-hooks .markdown-content-beforeUnmount', - ) - - await page.locator('.e2e-theme-nav ul > li > a').nth(0).click() - - await expect(beforeUnmountLocator).toHaveText('beforeUnmount: /') -}) diff --git a/e2e/tests/on-content-updated.spec.ts b/e2e/tests/on-content-updated.spec.ts new file mode 100644 index 0000000000..f174a7e2e6 --- /dev/null +++ b/e2e/tests/on-content-updated.spec.ts @@ -0,0 +1,65 @@ +import { expect, test } from '@playwright/test' +import { IS_DEV } from '../utils/env' +import { readSourceMarkdown, writeSourceMarkdown } from '../utils/source' + +const updateMarkdownContent = async (): Promise => { + const content = await readSourceMarkdown('content-hooks/content.md') + await writeSourceMarkdown( + 'content-hooks/content.md', + `${content}\n\nUpdated content`, + ) +} + +const restoreMarkdownContent = async (): Promise => { + await writeSourceMarkdown('content-hooks/content.md', '## title\n\ncontent\n') +} + +if (IS_DEV) { + test.afterAll(async () => { + await restoreMarkdownContent() + }) + + test('should call content hook on mounted', async ({ page }) => { + await page.goto('content-hooks/content.html') + const mountedLocator = page.locator( + '.markdown-content-hooks .markdown-content-mounted', + ) + await expect(mountedLocator).toHaveText( + 'mounted: /content-hooks/content.html 1', + ) + + // update content but mounted hook should not be called twice + await updateMarkdownContent() + await expect(mountedLocator).toHaveText( + 'mounted: /content-hooks/content.html 1', + ) + }) + + /** + * onContentChange hook should only called in development + */ + test('should call content hook on updated', async ({ page }) => { + await page.goto('content-hooks/content.html') + const updatedLocator = page.locator( + '.markdown-content-hooks .markdown-content-updated', + ) + + await updateMarkdownContent() + await expect(updatedLocator).toHaveText(`updatedCount: ${IS_DEV ? 1 : 0}`) // 1 + + await updateMarkdownContent() + await expect(updatedLocator).toHaveText(`updatedCount: ${IS_DEV ? 2 : 0}`) // 2 + }) + + test('should call content hook on beforeUnmount', async ({ page }) => { + await page.goto('content-hooks/content.html') + + const beforeUnmountLocator = page.locator( + '.markdown-content-hooks .markdown-content-beforeUnmount', + ) + + await page.locator('.e2e-theme-nav ul > li > a').nth(0).click() + + await expect(beforeUnmountLocator).toHaveText('beforeUnmount: /') + }) +} diff --git a/packages/client/src/composables/contentHooks.ts b/packages/client/src/composables/onContentUpdated.ts similarity index 100% rename from packages/client/src/composables/contentHooks.ts rename to packages/client/src/composables/onContentUpdated.ts From a3bcfcc8fde510e2be963acbc802d01247e31aa2 Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Fri, 21 Feb 2025 00:13:10 +0800 Subject: [PATCH 12/18] chore: tweak --- packages/client/src/composables/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/client/src/composables/index.ts b/packages/client/src/composables/index.ts index aa34aa20bb..52682d355d 100644 --- a/packages/client/src/composables/index.ts +++ b/packages/client/src/composables/index.ts @@ -1,4 +1,4 @@ export * from './clientData.js' export * from './clientDataUtils.js' export * from './updateHead.js' -export * from './contentHooks.js' +export * from './onContentUpdated.js' From 77bcd1449d93150146fc356521d9a0eac6ed5552 Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Fri, 21 Feb 2025 00:25:13 +0800 Subject: [PATCH 13/18] chore: tweak --- e2e/tests/on-content-updated.spec.ts | 73 ++++++++++++++-------------- 1 file changed, 37 insertions(+), 36 deletions(-) diff --git a/e2e/tests/on-content-updated.spec.ts b/e2e/tests/on-content-updated.spec.ts index f174a7e2e6..0d30c34e3d 100644 --- a/e2e/tests/on-content-updated.spec.ts +++ b/e2e/tests/on-content-updated.spec.ts @@ -1,5 +1,5 @@ import { expect, test } from '@playwright/test' -import { IS_DEV } from '../utils/env' +import { BUNDLER, IS_DEV } from '../utils/env' import { readSourceMarkdown, writeSourceMarkdown } from '../utils/source' const updateMarkdownContent = async (): Promise => { @@ -14,30 +14,43 @@ const restoreMarkdownContent = async (): Promise => { await writeSourceMarkdown('content-hooks/content.md', '## title\n\ncontent\n') } -if (IS_DEV) { - test.afterAll(async () => { - await restoreMarkdownContent() - }) +test.afterAll(async () => { + await restoreMarkdownContent() +}) - test('should call content hook on mounted', async ({ page }) => { - await page.goto('content-hooks/content.html') - const mountedLocator = page.locator( - '.markdown-content-hooks .markdown-content-mounted', - ) - await expect(mountedLocator).toHaveText( - 'mounted: /content-hooks/content.html 1', - ) +test('should call content hook on mounted', async ({ page }) => { + await page.goto('content-hooks/content.html') + const mountedLocator = page.locator( + '.markdown-content-hooks .markdown-content-mounted', + ) + await expect(mountedLocator).toHaveText( + 'mounted: /content-hooks/content.html 1', + ) - // update content but mounted hook should not be called twice - await updateMarkdownContent() - await expect(mountedLocator).toHaveText( - 'mounted: /content-hooks/content.html 1', - ) - }) + // update content but mounted hook should not be called twice + await updateMarkdownContent() + await expect(mountedLocator).toHaveText( + 'mounted: /content-hooks/content.html 1', + ) +}) + +test('should call content hook on beforeUnmount', async ({ page }) => { + await page.goto('content-hooks/content.html') - /** - * onContentChange hook should only called in development - */ + const beforeUnmountLocator = page.locator( + '.markdown-content-hooks .markdown-content-beforeUnmount', + ) + + await page.locator('.e2e-theme-nav ul > li > a').nth(0).click() + + await expect(beforeUnmountLocator).toHaveText('beforeUnmount: /') +}) + +/** + * Updated hooks are only supported for use in development environments. + * In CI environments, under both Linux and Windows, using Vite fails to correctly trigger hooks. + */ +if (IS_DEV && BUNDLER !== 'vite') { test('should call content hook on updated', async ({ page }) => { await page.goto('content-hooks/content.html') const updatedLocator = page.locator( @@ -45,21 +58,9 @@ if (IS_DEV) { ) await updateMarkdownContent() - await expect(updatedLocator).toHaveText(`updatedCount: ${IS_DEV ? 1 : 0}`) // 1 + await expect(updatedLocator).toHaveText(`updatedCount: 1`) await updateMarkdownContent() - await expect(updatedLocator).toHaveText(`updatedCount: ${IS_DEV ? 2 : 0}`) // 2 - }) - - test('should call content hook on beforeUnmount', async ({ page }) => { - await page.goto('content-hooks/content.html') - - const beforeUnmountLocator = page.locator( - '.markdown-content-hooks .markdown-content-beforeUnmount', - ) - - await page.locator('.e2e-theme-nav ul > li > a').nth(0).click() - - await expect(beforeUnmountLocator).toHaveText('beforeUnmount: /') + await expect(updatedLocator).toHaveText(`updatedCount: 2`) }) } From c3e88f830c6a537e406d06225a6692dbeff7f51a Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Fri, 21 Feb 2025 14:17:33 +0800 Subject: [PATCH 14/18] chore: tweak --- packages/client/src/components/Content.ts | 10 +++++----- packages/client/src/composables/index.ts | 2 +- packages/client/src/composables/onContentUpdated.ts | 5 ++++- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/packages/client/src/components/Content.ts b/packages/client/src/components/Content.ts index 44fb925203..6e08e6c44f 100644 --- a/packages/client/src/components/Content.ts +++ b/packages/client/src/components/Content.ts @@ -1,6 +1,6 @@ import { computed, defineAsyncComponent, defineComponent, h, watch } from 'vue' import { - runCallbacks, + runContentUpdatedCallbacks, usePageComponent, usePageFrontmatter, } from '../composables/index.js' @@ -34,7 +34,7 @@ export const Content = defineComponent({ watch( frontmatter, () => { - runCallbacks('updated') + runContentUpdatedCallbacks('updated') }, { deep: true, flush: 'post' }, ) @@ -42,13 +42,13 @@ export const Content = defineComponent({ return () => h(ContentComponent.value, { onVnodeMounted: () => { - runCallbacks('mounted') + runContentUpdatedCallbacks('mounted') }, onVnodeUpdated: () => { - runCallbacks('updated') + runContentUpdatedCallbacks('updated') }, onVnodeBeforeUnmount: () => { - runCallbacks('beforeUnmount') + runContentUpdatedCallbacks('beforeUnmount') }, }) }, diff --git a/packages/client/src/composables/index.ts b/packages/client/src/composables/index.ts index 52682d355d..b2a3e5ad54 100644 --- a/packages/client/src/composables/index.ts +++ b/packages/client/src/composables/index.ts @@ -1,4 +1,4 @@ export * from './clientData.js' export * from './clientDataUtils.js' -export * from './updateHead.js' export * from './onContentUpdated.js' +export * from './updateHead.js' diff --git a/packages/client/src/composables/onContentUpdated.ts b/packages/client/src/composables/onContentUpdated.ts index 7ec660c8e8..3e0c3e1070 100644 --- a/packages/client/src/composables/onContentUpdated.ts +++ b/packages/client/src/composables/onContentUpdated.ts @@ -16,6 +16,9 @@ export const onContentUpdated = (fn: ContentUpdatedCallback): void => { }) } -export function runCallbacks(reason: ContentUpdatedReason): void { +/** @internal */ +export const runContentUpdatedCallbacks = ( + reason: ContentUpdatedReason, +): void => { contentUpdatedCallbacks.forEach((fn) => fn(reason)) } From 23d2c6ecbd1c48895c1819b0bb26a67e9135a2b6 Mon Sep 17 00:00:00 2001 From: pengzhanbo Date: Fri, 21 Feb 2025 14:21:29 +0800 Subject: [PATCH 15/18] chore: tweak --- packages/client/src/composables/onContentUpdated.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/client/src/composables/onContentUpdated.ts b/packages/client/src/composables/onContentUpdated.ts index 3e0c3e1070..8322c53e81 100644 --- a/packages/client/src/composables/onContentUpdated.ts +++ b/packages/client/src/composables/onContentUpdated.ts @@ -16,7 +16,10 @@ export const onContentUpdated = (fn: ContentUpdatedCallback): void => { }) } -/** @internal */ +/** + * Execute all callbacks registered via `onContentUpdated`. + * @internal + */ export const runContentUpdatedCallbacks = ( reason: ContentUpdatedReason, ): void => { From 0701e379068015baead77dbfb304d12751599cf7 Mon Sep 17 00:00:00 2001 From: meteorlxy Date: Sun, 23 Feb 2025 22:46:53 +0800 Subject: [PATCH 16/18] chore: updates --- packages/client/src/components/Content.ts | 17 ++++++++++---- .../src/composables/onContentUpdated.ts | 23 +++++-------------- .../src/internal/contentUpdatedCallbacks.ts | 9 ++++++++ packages/client/src/types/contentUpdated.ts | 3 +++ packages/client/src/types/index.ts | 1 + 5 files changed, 31 insertions(+), 22 deletions(-) create mode 100644 packages/client/src/internal/contentUpdatedCallbacks.ts create mode 100644 packages/client/src/types/contentUpdated.ts diff --git a/packages/client/src/components/Content.ts b/packages/client/src/components/Content.ts index 6e08e6c44f..aedd941dc2 100644 --- a/packages/client/src/components/Content.ts +++ b/packages/client/src/components/Content.ts @@ -1,10 +1,17 @@ import { computed, defineAsyncComponent, defineComponent, h, watch } from 'vue' -import { - runContentUpdatedCallbacks, - usePageComponent, - usePageFrontmatter, -} from '../composables/index.js' +import { usePageComponent, usePageFrontmatter } from '../composables/index.js' +import { contentUpdatedCallbacks } from '../internal/contentUpdatedCallbacks' import { resolveRoute } from '../router/index.js' +import type { ContentUpdatedReason } from '../types/index.js' + +/** + * Execute all callbacks registered via `onContentUpdated`. + * + * @internal + */ +const runContentUpdatedCallbacks = (reason: ContentUpdatedReason): void => { + contentUpdatedCallbacks.value.forEach((fn) => fn(reason)) +} /** * Markdown rendered content diff --git a/packages/client/src/composables/onContentUpdated.ts b/packages/client/src/composables/onContentUpdated.ts index 8322c53e81..acddd15d80 100644 --- a/packages/client/src/composables/onContentUpdated.ts +++ b/packages/client/src/composables/onContentUpdated.ts @@ -1,27 +1,16 @@ import { onUnmounted } from 'vue' - -type ContentUpdatedReason = 'beforeUnmount' | 'mounted' | 'updated' -type ContentUpdatedCallback = (reason: ContentUpdatedReason) => unknown - -let contentUpdatedCallbacks: ContentUpdatedCallback[] = [] +import { contentUpdatedCallbacks } from '../internal/contentUpdatedCallbacks' +import type { ContentUpdatedCallback } from '../types/index.js' /** * Register callback that is called every time the markdown content is updated * in the DOM. */ export const onContentUpdated = (fn: ContentUpdatedCallback): void => { - contentUpdatedCallbacks.push(fn) + contentUpdatedCallbacks.value.push(fn) onUnmounted(() => { - contentUpdatedCallbacks = contentUpdatedCallbacks.filter((f) => f !== fn) + contentUpdatedCallbacks.value = contentUpdatedCallbacks.value.filter( + (f) => f !== fn, + ) }) } - -/** - * Execute all callbacks registered via `onContentUpdated`. - * @internal - */ -export const runContentUpdatedCallbacks = ( - reason: ContentUpdatedReason, -): void => { - contentUpdatedCallbacks.forEach((fn) => fn(reason)) -} diff --git a/packages/client/src/internal/contentUpdatedCallbacks.ts b/packages/client/src/internal/contentUpdatedCallbacks.ts new file mode 100644 index 0000000000..a0f9471c5b --- /dev/null +++ b/packages/client/src/internal/contentUpdatedCallbacks.ts @@ -0,0 +1,9 @@ +import type { Ref } from 'vue' +import { shallowRef } from 'vue' +import type { ContentUpdatedCallback } from '../types/index.js' + +/** + * Global content updated callbacks ref + */ +export const contentUpdatedCallbacks: Ref = + shallowRef([]) diff --git a/packages/client/src/types/contentUpdated.ts b/packages/client/src/types/contentUpdated.ts new file mode 100644 index 0000000000..16c5e096b2 --- /dev/null +++ b/packages/client/src/types/contentUpdated.ts @@ -0,0 +1,3 @@ +export type ContentUpdatedReason = 'beforeUnmount' | 'mounted' | 'updated' + +export type ContentUpdatedCallback = (reason: ContentUpdatedReason) => unknown diff --git a/packages/client/src/types/index.ts b/packages/client/src/types/index.ts index c07dbc3fcd..e0cc2604b9 100644 --- a/packages/client/src/types/index.ts +++ b/packages/client/src/types/index.ts @@ -1,4 +1,5 @@ export type * from './clientConfig.js' export type * from './clientData.js' +export type * from './contentUpdated.js' export type * from './createVueAppFunction.js' export type * from './routes.js' From a91367a3a81a7e411a36fa4e79f7f59f5a530ef3 Mon Sep 17 00:00:00 2001 From: meteorlxy Date: Sun, 23 Feb 2025 23:06:48 +0800 Subject: [PATCH 17/18] test: update e2e --- .../on-content-updated.md} | 0 .../on-content-updated.spec.ts | 23 +++++++++++-------- 2 files changed, 13 insertions(+), 10 deletions(-) rename e2e/docs/{content-hooks/content.md => composables/on-content-updated.md} (100%) rename e2e/tests/{ => composables}/on-content-updated.spec.ts (71%) diff --git a/e2e/docs/content-hooks/content.md b/e2e/docs/composables/on-content-updated.md similarity index 100% rename from e2e/docs/content-hooks/content.md rename to e2e/docs/composables/on-content-updated.md diff --git a/e2e/tests/on-content-updated.spec.ts b/e2e/tests/composables/on-content-updated.spec.ts similarity index 71% rename from e2e/tests/on-content-updated.spec.ts rename to e2e/tests/composables/on-content-updated.spec.ts index 0d30c34e3d..c3fce8d8f0 100644 --- a/e2e/tests/on-content-updated.spec.ts +++ b/e2e/tests/composables/on-content-updated.spec.ts @@ -1,17 +1,20 @@ import { expect, test } from '@playwright/test' -import { BUNDLER, IS_DEV } from '../utils/env' -import { readSourceMarkdown, writeSourceMarkdown } from '../utils/source' +import { BUNDLER, IS_DEV } from '../../utils/env' +import { readSourceMarkdown, writeSourceMarkdown } from '../../utils/source' const updateMarkdownContent = async (): Promise => { - const content = await readSourceMarkdown('content-hooks/content.md') + const content = await readSourceMarkdown('composables/on-content-updated.md') await writeSourceMarkdown( - 'content-hooks/content.md', + 'composables/on-content-updated.md', `${content}\n\nUpdated content`, ) } const restoreMarkdownContent = async (): Promise => { - await writeSourceMarkdown('content-hooks/content.md', '## title\n\ncontent\n') + await writeSourceMarkdown( + 'composables/on-content-updated.md', + '## title\n\ncontent\n', + ) } test.afterAll(async () => { @@ -19,23 +22,23 @@ test.afterAll(async () => { }) test('should call content hook on mounted', async ({ page }) => { - await page.goto('content-hooks/content.html') + await page.goto('composables/on-content-updated.html') const mountedLocator = page.locator( '.markdown-content-hooks .markdown-content-mounted', ) await expect(mountedLocator).toHaveText( - 'mounted: /content-hooks/content.html 1', + 'mounted: /composables/on-content-updated.html 1', ) // update content but mounted hook should not be called twice await updateMarkdownContent() await expect(mountedLocator).toHaveText( - 'mounted: /content-hooks/content.html 1', + 'mounted: /composables/on-content-updated.html 1', ) }) test('should call content hook on beforeUnmount', async ({ page }) => { - await page.goto('content-hooks/content.html') + await page.goto('composables/on-content-updated.html') const beforeUnmountLocator = page.locator( '.markdown-content-hooks .markdown-content-beforeUnmount', @@ -52,7 +55,7 @@ test('should call content hook on beforeUnmount', async ({ page }) => { */ if (IS_DEV && BUNDLER !== 'vite') { test('should call content hook on updated', async ({ page }) => { - await page.goto('content-hooks/content.html') + await page.goto('composables/on-content-updated.html') const updatedLocator = page.locator( '.markdown-content-hooks .markdown-content-updated', ) From cd02733ebecf293e9c0fee62fd7d5c11737957e2 Mon Sep 17 00:00:00 2001 From: meteorlxy Date: Sun, 23 Feb 2025 23:19:35 +0800 Subject: [PATCH 18/18] chore: tweaks --- packages/client/src/types/index.ts | 2 +- .../client/src/types/{contentUpdated.ts => onContentUpdated.ts} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename packages/client/src/types/{contentUpdated.ts => onContentUpdated.ts} (100%) diff --git a/packages/client/src/types/index.ts b/packages/client/src/types/index.ts index e0cc2604b9..a1d85e5487 100644 --- a/packages/client/src/types/index.ts +++ b/packages/client/src/types/index.ts @@ -1,5 +1,5 @@ export type * from './clientConfig.js' export type * from './clientData.js' -export type * from './contentUpdated.js' +export type * from './onContentUpdated.js' export type * from './createVueAppFunction.js' export type * from './routes.js' diff --git a/packages/client/src/types/contentUpdated.ts b/packages/client/src/types/onContentUpdated.ts similarity index 100% rename from packages/client/src/types/contentUpdated.ts rename to packages/client/src/types/onContentUpdated.ts