From 4d1be089d7d363ffff22b3a6182df31230541784 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Wed, 9 Nov 2022 10:07:22 +0100 Subject: [PATCH] chore(nuxt): remove unused plugins (#8819) --- .../nuxt/src/app/plugins/logs.client.dev.ts | 13 ------ .../nuxt/src/app/plugins/progress.client.ts | 43 ------------------- 2 files changed, 56 deletions(-) delete mode 100644 packages/nuxt/src/app/plugins/logs.client.dev.ts delete mode 100644 packages/nuxt/src/app/plugins/progress.client.ts diff --git a/packages/nuxt/src/app/plugins/logs.client.dev.ts b/packages/nuxt/src/app/plugins/logs.client.dev.ts deleted file mode 100644 index 27eecafe7c..0000000000 --- a/packages/nuxt/src/app/plugins/logs.client.dev.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { defineNuxtPlugin } from '#app' - -export default defineNuxtPlugin((nuxtApp) => { - // Only activate in development - const logs = nuxtApp.payload.logs || [] - if (logs.length > 0) { - const ssrLogStyle = 'background: #003C3C;border-radius: 0.5em;color: white;font-weight: bold;padding: 2px 0.5em;' - console.groupCollapsed && console.groupCollapsed('%cNuxt Server Logs', ssrLogStyle) - logs.forEach((logObj: any) => (console[logObj.type as 'log'] || console.log)(...logObj.args)) - delete nuxtApp.payload.logs - console.groupEnd && console.groupEnd() - } -}) diff --git a/packages/nuxt/src/app/plugins/progress.client.ts b/packages/nuxt/src/app/plugins/progress.client.ts deleted file mode 100644 index 673172cb51..0000000000 --- a/packages/nuxt/src/app/plugins/progress.client.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { defineNuxtPlugin } from '#app' - -export default defineNuxtPlugin((nuxtApp) => { - nuxtApp.hook('app:mounted', () => { - const el = document.createElement('div') - el.id = 'nuxt-progress' - document.body.appendChild(el) - el.style.position = 'fixed' - el.style.backgroundColor = 'black' - el.style.height = '2px' - el.style.top = '0px' - el.style.left = '0px' - el.style.transition = 'width 0.1s, opacity 0.4s' - const duration = 3000 - const progress = 10000 / Math.floor(duration) - let timeout: ReturnType | undefined - let interval: ReturnType | undefined - nuxtApp.hook('page:start', () => { - if (timeout) { return } - timeout = setTimeout(() => { - let width = 10 - el.style.opacity = '100%' - el.style.width = '10%' - interval = setInterval(() => { - if (width >= 100) { return } - width = Math.floor(width + progress) - el.style.width = `${width}%` - }, 100) - }, 200) - }) - nuxtApp.hook('page:finish', () => { - timeout && clearTimeout(timeout) - timeout = undefined - interval && clearInterval(interval) - interval = undefined - el.style.width = '100%' - el.style.opacity = '0%' - setTimeout(() => { - el.style.width = '0%' - }, 500) - }) - }) -})