From 6eefc98e49c6d3c253e9763eb5af97b6668f9e1a Mon Sep 17 00:00:00 2001 From: Martin Masevski Date: Thu, 8 Aug 2024 10:48:52 +0200 Subject: [PATCH] fix(nuxt): update renamed stub composables from `nuxt/scripts` (#28449) --- packages/nuxt/src/app/composables/script-stubs.ts | 12 ++++++------ packages/nuxt/src/imports/presets.ts | 6 +++--- packages/nuxt/test/auto-imports.test.ts | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/packages/nuxt/src/app/composables/script-stubs.ts b/packages/nuxt/src/app/composables/script-stubs.ts index 7fcf5df5e6..f1f54c9ff2 100644 --- a/packages/nuxt/src/app/composables/script-stubs.ts +++ b/packages/nuxt/src/app/composables/script-stubs.ts @@ -18,18 +18,18 @@ export function useScript> (input: UseScr } // eslint-disable-next-line @typescript-eslint/no-unused-vars -export function useElementScriptTrigger (...args: unknown[]) { - renderStubMessage('useElementScriptTrigger') +export function useScriptTriggerElement (...args: unknown[]) { + renderStubMessage('useScriptTriggerElement') } // eslint-disable-next-line @typescript-eslint/no-unused-vars -export function useConsentScriptTrigger (...args: unknown[]) { - renderStubMessage('useConsentScriptTrigger') +export function useScriptTriggerConsent (...args: unknown[]) { + renderStubMessage('useScriptTriggerConsent') } // eslint-disable-next-line @typescript-eslint/no-unused-vars -export function useAnalyticsPageEvent (...args: unknown[]) { - renderStubMessage('useAnalyticsPageEvent') +export function useScriptEventPage (...args: unknown[]) { + renderStubMessage('useScriptEventPage') } // eslint-disable-next-line @typescript-eslint/no-unused-vars diff --git a/packages/nuxt/src/imports/presets.ts b/packages/nuxt/src/imports/presets.ts index 8a21072ad8..7c68e99be0 100644 --- a/packages/nuxt/src/imports/presets.ts +++ b/packages/nuxt/src/imports/presets.ts @@ -117,9 +117,9 @@ const granularAppPresets: InlinePreset[] = [ export const scriptsStubsPreset = { imports: [ - 'useConsentScriptTrigger', - 'useAnalyticsPageEvent', - 'useElementScriptTrigger', + 'useScriptTriggerConsent', + 'useScriptEventPage', + 'useScriptTriggerElement', 'useScript', 'useScriptGoogleAnalytics', 'useScriptPlausibleAnalytics', diff --git a/packages/nuxt/test/auto-imports.test.ts b/packages/nuxt/test/auto-imports.test.ts index 2a4c5c3c1f..c974c8998f 100644 --- a/packages/nuxt/test/auto-imports.test.ts +++ b/packages/nuxt/test/auto-imports.test.ts @@ -200,9 +200,9 @@ describe('imports:nuxt/scripts', () => { const scripts = scriptRegistry().map(s => s.import?.name).filter(Boolean) const globalScripts = new Set([ 'useScript', - 'useAnalyticsPageEvent', - 'useElementScriptTrigger', - 'useConsentScriptTrigger', + 'useScriptEventPage', + 'useScriptTriggerElement', + 'useScriptTriggerConsent', // registered separately 'useScriptGoogleTagManager', 'useScriptGoogleAnalytics',