From c6ca0f5c0144302b4114a7213dafdbe01baaa64a Mon Sep 17 00:00:00 2001 From: Evan Song Date: Wed, 10 Jul 2024 19:24:34 -0700 Subject: [PATCH 1/4] fix(temp): remove box shadows from tailwind config --- apps/frontend/tailwind.config.js | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/apps/frontend/tailwind.config.js b/apps/frontend/tailwind.config.js index 1b34e5b70..6f54dc01f 100644 --- a/apps/frontend/tailwind.config.js +++ b/apps/frontend/tailwind.config.js @@ -120,19 +120,6 @@ module.exports = { rawBg: "var(--landing-raw-bg)", }, }, - boxShadow: { - insetLg: "var(--shadow-inset-lg)", - inset: "var(--shadow-inset)", - insetSm: "var(--shadow-inset-sm)", - raisedLg: "var(--shadow-raised-lg)", - raised: "var(--shadow-raised)", - floating: "var(--shadow-floating)", - card: "var(--shadow-card)", - landing: { - blobShadow: "var(--landing-blob-shadow)", - cardShadow: "var(--landing-card-shadow)", - }, - }, }, }, plugins: [], From 30a4a75d386013b5a64e0fe56642e6ba6a416c16 Mon Sep 17 00:00:00 2001 From: Evan Song Date: Wed, 10 Jul 2024 20:26:59 -0700 Subject: [PATCH 2/4] fix(temp): "polyfill" global during build process --- apps/frontend/nuxt.config.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/apps/frontend/nuxt.config.ts b/apps/frontend/nuxt.config.ts index eb44320f0..e8de813c9 100644 --- a/apps/frontend/nuxt.config.ts +++ b/apps/frontend/nuxt.config.ts @@ -80,6 +80,14 @@ export default defineNuxtConfig({ }, }, vite: { + define: { + global: {}, + }, + esbuild: { + define: { + global: "globalThis", + }, + }, cacheDir: "../../node_modules/.vite/apps/knossos", resolve: { dedupe: ["vue"], From 370e168af07cc33268023995492060d69402c5ce Mon Sep 17 00:00:00 2001 From: fero Date: Wed, 10 Jul 2024 22:12:39 -0700 Subject: [PATCH 3/4] refactor: use `import.meta` instead of deprecated `process` --- .../src/components/ui/charts/CompactChart.client.vue | 2 +- .../src/components/ui/modrinth-loading-indicator.ts | 6 +++--- apps/frontend/src/composables/theme.js | 2 +- apps/frontend/src/layouts/default.vue | 4 ++-- apps/frontend/src/pages/[type]/[id].vue | 2 +- apps/frontend/src/pages/[type]/[id]/version/[version].vue | 2 +- apps/frontend/src/pages/dashboard/collections.vue | 2 +- apps/frontend/src/pages/dashboard/notifications.vue | 2 +- apps/frontend/src/pages/search/[searchProjectType].vue | 4 ++-- apps/frontend/src/plugins/1.theme.js | 2 +- 10 files changed, 14 insertions(+), 14 deletions(-) diff --git a/apps/frontend/src/components/ui/charts/CompactChart.client.vue b/apps/frontend/src/components/ui/charts/CompactChart.client.vue index 2c418bbd6..17d884434 100644 --- a/apps/frontend/src/components/ui/charts/CompactChart.client.vue +++ b/apps/frontend/src/components/ui/charts/CompactChart.client.vue @@ -3,7 +3,7 @@ import { Card } from "@modrinth/ui"; import VueApexCharts from "vue3-apexcharts"; // let VueApexCharts -// if (process.client) { +// if (import.meta.client) { // VueApexCharts = defineAsyncComponent(() => import('vue3-apexcharts')) // } diff --git a/apps/frontend/src/components/ui/modrinth-loading-indicator.ts b/apps/frontend/src/components/ui/modrinth-loading-indicator.ts index 4081b3faa..688a162b7 100644 --- a/apps/frontend/src/components/ui/modrinth-loading-indicator.ts +++ b/apps/frontend/src/components/ui/modrinth-loading-indicator.ts @@ -85,7 +85,7 @@ function useLoadingIndicator(opts: { duration: number; throttle: number }) { function start() { clear(); progress.value = 0; - if (opts.throttle && process.client) { + if (opts.throttle && import.meta.client) { _throttle = setTimeout(() => { isLoading.value = true; _startTimer(); @@ -113,7 +113,7 @@ function useLoadingIndicator(opts: { duration: number; throttle: number }) { function _hide() { clear(); - if (process.client) { + if (import.meta.client) { setTimeout(() => { isLoading.value = false; setTimeout(() => { @@ -124,7 +124,7 @@ function useLoadingIndicator(opts: { duration: number; throttle: number }) { } function _startTimer() { - if (process.client) { + if (import.meta.client) { _timer = setInterval(() => { _increase(step.value); }, 100); diff --git a/apps/frontend/src/composables/theme.js b/apps/frontend/src/composables/theme.js index f2401e12b..460ebdf1f 100644 --- a/apps/frontend/src/composables/theme.js +++ b/apps/frontend/src/composables/theme.js @@ -48,7 +48,7 @@ export const updateTheme = (value, updatePreference = false) => { if (updatePreference) theme.value.preference = value; } - if (process.client) { + if (import.meta.client) { document.documentElement.className = `${theme.value.value}-mode`; } diff --git a/apps/frontend/src/layouts/default.vue b/apps/frontend/src/layouts/default.vue index 1d5db44d1..4be98be2a 100644 --- a/apps/frontend/src/layouts/default.vue +++ b/apps/frontend/src/layouts/default.vue @@ -654,7 +654,7 @@ const navRoutes = computed(() => [ ]); onMounted(() => { - if (window && process.client) { + if (window && import.meta.client) { window.history.scrollRestoration = "auto"; } @@ -667,7 +667,7 @@ watch( isMobileMenuOpen.value = false; isBrowseMenuOpen.value = false; - if (process.client) { + if (import.meta.client) { document.body.style.overflowY = "scroll"; document.body.setAttribute("tabindex", "-1"); document.body.removeAttribute("tabindex"); diff --git a/apps/frontend/src/pages/[type]/[id].vue b/apps/frontend/src/pages/[type]/[id].vue index 70c739ff5..691cf9e5d 100644 --- a/apps/frontend/src/pages/[type]/[id].vue +++ b/apps/frontend/src/pages/[type]/[id].vue @@ -1500,7 +1500,7 @@ const collapsedChecklist = ref(false); const showModerationChecklist = ref(false); const futureProjects = ref([]); -if (process.client && history && history.state && history.state.showChecklist) { +if (import.meta.client && history && history.state && history.state.showChecklist) { showModerationChecklist.value = true; futureProjects.value = history.state.projects; } diff --git a/apps/frontend/src/pages/[type]/[id]/version/[version].vue b/apps/frontend/src/pages/[type]/[id]/version/[version].vue index 30707c3cf..31507f40e 100644 --- a/apps/frontend/src/pages/[type]/[id]/version/[version].vue +++ b/apps/frontend/src/pages/[type]/[id]/version/[version].vue @@ -779,7 +779,7 @@ export default defineNuxtComponent({ featured: false, }; // For navigation from versions page / upload file prompt - if (process.client && history.state && history.state.newPrimaryFile) { + if (import.meta.client && history.state && history.state.newPrimaryFile) { replaceFile = history.state.newPrimaryFile; try { diff --git a/apps/frontend/src/pages/dashboard/collections.vue b/apps/frontend/src/pages/dashboard/collections.vue index 4a5a37188..66ebb86eb 100644 --- a/apps/frontend/src/pages/dashboard/collections.vue +++ b/apps/frontend/src/pages/dashboard/collections.vue @@ -130,7 +130,7 @@ useHead({ const user = await useUser(); const auth = await useAuth(); -if (process.client) { +if (import.meta.client) { await initUserFollows(); } diff --git a/apps/frontend/src/pages/dashboard/notifications.vue b/apps/frontend/src/pages/dashboard/notifications.vue index db06b5ddd..2c4f839d2 100644 --- a/apps/frontend/src/pages/dashboard/notifications.vue +++ b/apps/frontend/src/pages/dashboard/notifications.vue @@ -152,7 +152,7 @@ async function readAll() { function changePage(newPage) { page.value = newPage; - if (process.client) { + if (import.meta.client) { window.scrollTo({ top: 0, behavior: "smooth" }); } } diff --git a/apps/frontend/src/pages/search/[searchProjectType].vue b/apps/frontend/src/pages/search/[searchProjectType].vue index b33a42a03..5d0cfa420 100644 --- a/apps/frontend/src/pages/search/[searchProjectType].vue +++ b/apps/frontend/src/pages/search/[searchProjectType].vue @@ -589,7 +589,7 @@ function onSearchChange(newPageNumber) { refreshSearch(); - if (process.client) { + if (import.meta.client) { const obj = getSearchUrl((currentPage.value - 1) * maxResults.value, true); router.replace({ path: route.path, query: obj }); } @@ -751,7 +751,7 @@ function toggleEnv(environment, sendRequest) { } function onSearchChangeToTop(newPageNumber) { - if (process.client) { + if (import.meta.client) { window.scrollTo({ top: 0, behavior: "smooth" }); } diff --git a/apps/frontend/src/plugins/1.theme.js b/apps/frontend/src/plugins/1.theme.js index f9f420858..5f6961b5a 100644 --- a/apps/frontend/src/plugins/1.theme.js +++ b/apps/frontend/src/plugins/1.theme.js @@ -5,7 +5,7 @@ export default defineNuxtPlugin(async (nuxtApp) => { const cosmetics = useCosmetics(); nuxtApp.hook("app:mounted", () => { - if (process.client && themeStore.value.preference === "system") { + if (import.meta.client && themeStore.value.preference === "system") { const colorSchemeQueryList = window.matchMedia("(prefers-color-scheme: light)"); const setColorScheme = (e) => { From 7a53fab674f353a82eacc3efbf5cf049c74c93e2 Mon Sep 17 00:00:00 2001 From: fero Date: Wed, 10 Jul 2024 22:13:50 -0700 Subject: [PATCH 4/4] oops: replace `process.server` as well --- apps/frontend/src/composables/fetch.js | 4 ++-- apps/frontend/src/pages/search/[searchProjectType].vue | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/frontend/src/composables/fetch.js b/apps/frontend/src/composables/fetch.js index 3529c018b..91f765ce3 100644 --- a/apps/frontend/src/composables/fetch.js +++ b/apps/frontend/src/composables/fetch.js @@ -1,12 +1,12 @@ export const useBaseFetch = async (url, options = {}, skipAuth = false) => { const config = useRuntimeConfig(); - let base = process.server ? config.apiBaseUrl : config.public.apiBaseUrl; + let base = import.meta.server ? config.apiBaseUrl : config.public.apiBaseUrl; if (!options.headers) { options.headers = {}; } - if (process.server) { + if (import.meta.server) { options.headers["x-ratelimit-key"] = config.rateLimitKey; } diff --git a/apps/frontend/src/pages/search/[searchProjectType].vue b/apps/frontend/src/pages/search/[searchProjectType].vue index 5d0cfa420..d816743ca 100644 --- a/apps/frontend/src/pages/search/[searchProjectType].vue +++ b/apps/frontend/src/pages/search/[searchProjectType].vue @@ -465,7 +465,7 @@ const { } = useLazyFetch( () => { const config = useRuntimeConfig(); - const base = process.server ? config.apiBaseUrl : config.public.apiBaseUrl; + const base = import.meta.server ? config.apiBaseUrl : config.public.apiBaseUrl; const params = [`limit=${maxResults.value}`, `index=${sortType.value.name}`];