From b07a1659b444be2f52dca7ab030f2fa4517a0a73 Mon Sep 17 00:00:00 2001 From: "Calum H." Date: Tue, 30 Dec 2025 15:06:52 +0000 Subject: [PATCH] chore: update to nuxt 3.20 (#4992) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: nuxt 3.14 → 3.15.4 * feat: nuxt 3.15.4 → 3.16.2 (vite 6) * feat: bump nuxt-i18n * feat: nuxt 3.20 * fix: lint * feat: use rolldown-vite * fix: shut the fuck up * fix: silence for app as well * fix: vue-router mismatch --------- Signed-off-by: Calum H. --- apps/app-frontend/package.json | 10 +- .../components/ui/InstanceCreationModal.vue | 4 +- .../src/components/ui/ProjectCard.vue | 2 +- .../src/components/ui/SplashScreen.vue | 3 +- .../src/components/ui/world/WorldItem.vue | 4 +- apps/app-frontend/vite.config.ts | 8 + apps/frontend/{src => i18n}/i18n.config.ts | 10 +- apps/frontend/nuxt.config.ts | 38 +- apps/frontend/package.json | 17 +- apps/frontend/src/app.vue | 1 + apps/frontend/src/plugins/floating-vue.js | 20 - package.json | 9 + packages/api-client/src/features/auth.ts | 2 +- .../src/features/circuit-breaker.ts | 2 +- packages/api-client/src/features/retry.ts | 2 +- packages/api-client/src/platform/nuxt.ts | 2 +- packages/api-client/src/platform/tauri.ts | 2 +- packages/assets/styles/classes.scss | 14 +- packages/assets/styles/defaults.scss | 5 +- packages/assets/styles/variables.scss | 9 +- .../moderation/src/data/nags/description.ts | 24 +- packages/moderation/src/data/stages/links.ts | 8 +- packages/tooling-config/eslint/nuxt.mjs | 1 + packages/tooling-config/package.json | 2 + packages/ui/package.json | 6 +- .../billing/ServersUpgradeModalWrapper.vue | 4 +- .../ui/src/components/skin/SkinButton.vue | 3 +- .../components/skin/SkinLikeTextButton.vue | 3 +- .../components/skin/SkinPreviewRenderer.vue | 7 +- packages/ui/src/composables/i18n.ts | 5 +- pnpm-lock.yaml | 13193 ++++++++-------- 31 files changed, 6760 insertions(+), 6660 deletions(-) rename apps/frontend/{src => i18n}/i18n.config.ts (73%) delete mode 100644 apps/frontend/src/plugins/floating-vue.js diff --git a/apps/app-frontend/package.json b/apps/app-frontend/package.json index a0468e289..c7561a588 100644 --- a/apps/app-frontend/package.json +++ b/apps/app-frontend/package.json @@ -29,18 +29,18 @@ "@tauri-apps/plugin-window-state": "^2.2.2", "@types/three": "^0.172.0", "intl-messageformat": "^10.7.7", - "vue-i18n": "^9.14.0", + "vue-i18n": "^10.0.0", "@vueuse/core": "^11.1.0", "dayjs": "^1.11.10", "floating-vue": "^5.2.2", "ofetch": "^1.3.4", - "pinia": "^2.1.7", + "pinia": "^3.0.0", "posthog-js": "^1.158.2", "three": "^0.172.0", "vite-svg-loader": "^5.1.0", "vue": "^3.5.13", "vue-multiselect": "3.0.0", - "vue-router": "4.3.0", + "vue-router": "^4.6.0", "vue-virtual-scroller": "v2.0.0-beta.8" }, "devDependencies": { @@ -49,7 +49,7 @@ "@modrinth/tooling-config": "workspace:*", "@nuxt/eslint-config": "^0.5.6", "@taijased/vue-render-tracker": "^1.0.7", - "@vitejs/plugin-vue": "^5.0.4", + "@vitejs/plugin-vue": "^6.0.3", "autoprefixer": "^10.4.19", "eslint": "^9.9.1", "eslint-plugin-turbo": "^2.5.4", @@ -58,7 +58,7 @@ "sass": "^1.74.1", "tailwindcss": "^3.4.4", "typescript": "^5.5.4", - "vite": "^5.4.6", + "vite": "^6.0.0", "vue-component-type-helpers": "^3.1.8", "vue-tsc": "^2.1.6" }, diff --git a/apps/app-frontend/src/components/ui/InstanceCreationModal.vue b/apps/app-frontend/src/components/ui/InstanceCreationModal.vue index 83dee767f..a8158f07c 100644 --- a/apps/app-frontend/src/components/ui/InstanceCreationModal.vue +++ b/apps/app-frontend/src/components/ui/InstanceCreationModal.vue @@ -341,7 +341,7 @@ const create_instance = async () => { creating.value = true const loader_version_value = loader_version.value === 'other' ? specified_loader_version.value : loader_version.value - const loaderVersion = loader.value === 'vanilla' ? null : loader_version_value ?? 'stable' + const loaderVersion = loader.value === 'vanilla' ? null : (loader_version_value ?? 'stable') hide() creating.value = false @@ -350,7 +350,7 @@ const create_instance = async () => { profile_name.value, game_version.value, loader.value, - loader.value === 'vanilla' ? null : loader_version_value ?? 'stable', + loader.value === 'vanilla' ? null : (loader_version_value ?? 'stable'), icon.value, ).catch(handleError) diff --git a/apps/app-frontend/src/components/ui/ProjectCard.vue b/apps/app-frontend/src/components/ui/ProjectCard.vue index 2d23f3ae3..43e9a10df 100644 --- a/apps/app-frontend/src/components/ui/ProjectCard.vue +++ b/apps/app-frontend/src/components/ui/ProjectCard.vue @@ -63,7 +63,7 @@ const toTransparent = computed(() => {
diff --git a/apps/app-frontend/vite.config.ts b/apps/app-frontend/vite.config.ts index ac1c29a04..3b35e2df6 100644 --- a/apps/app-frontend/vite.config.ts +++ b/apps/app-frontend/vite.config.ts @@ -9,6 +9,14 @@ const projectRootDir = resolve(__dirname) // https://vitejs.dev/config/ export default defineConfig({ + css: { + preprocessorOptions: { + scss: { + // TODO: dont forget about this + silenceDeprecations: ['import'], + }, + }, + }, resolve: { alias: [ { diff --git a/apps/frontend/src/i18n.config.ts b/apps/frontend/i18n/i18n.config.ts similarity index 73% rename from apps/frontend/src/i18n.config.ts rename to apps/frontend/i18n/i18n.config.ts index 71f594342..6810b4bcd 100644 --- a/apps/frontend/src/i18n.config.ts +++ b/apps/frontend/i18n/i18n.config.ts @@ -1,8 +1,11 @@ import { buildLocaleMessages, createMessageCompiler, type CrowdinMessages } from '@modrinth/ui' -const localeModules = import.meta.glob<{ default: CrowdinMessages }>('./locales/*/index.json', { - eager: true, -}) +const localeModules = import.meta.glob<{ default: CrowdinMessages }>( + '../src/locales/*/index.json', + { + eager: true, + }, +) export default defineI18nConfig(() => ({ legacy: false, @@ -11,5 +14,6 @@ export default defineI18nConfig(() => ({ messageCompiler: createMessageCompiler(), missingWarn: false, fallbackWarn: false, + // @ts-expect-error - buildLocaleMessages returns compatible format at runtime messages: buildLocaleMessages(localeModules), })) diff --git a/apps/frontend/nuxt.config.ts b/apps/frontend/nuxt.config.ts index 472f5bb6f..d73794de8 100644 --- a/apps/frontend/nuxt.config.ts +++ b/apps/frontend/nuxt.config.ts @@ -56,6 +56,18 @@ export default defineNuxtConfig({ }, }, vite: { + css: { + preprocessorOptions: { + scss: { + // TODO: dont forget about this + silenceDeprecations: ['import'], + }, + }, + }, + ssr: { + // https://github.com/Akryum/floating-vue/issues/809#issuecomment-1002996240 + noExternal: ['v-tooltip'], + }, define: { global: {}, }, @@ -196,9 +208,24 @@ export default defineNuxtConfig({ }, }, }, - modules: ['@nuxtjs/i18n', '@pinia/nuxt'], + modules: ['@nuxtjs/i18n', '@pinia/nuxt', 'floating-vue/nuxt'], + floatingVue: { + themes: { + 'ribbit-popout': { + $extend: 'dropdown', + placement: 'bottom-end', + instantMove: true, + distance: 8, + }, + 'dismissable-prompt': { + $extend: 'dropdown', + placement: 'bottom-start', + }, + }, + }, i18n: { defaultLocale: 'en-US', + // @ts-expect-error - LocaleDefinition is compatible at runtime locales: LOCALES, strategy: 'no_prefix', detectBrowserLanguage: { @@ -206,11 +233,14 @@ export default defineNuxtConfig({ cookieKey: 'locale', fallbackLocale: 'en-US', }, - vueI18n: './src/i18n.config.ts', + vueI18n: './i18n.config.ts', + bundle: { + optimizeTranslationDirective: false, + }, }, nitro: { rollupConfig: { - // @ts-expect-error it's not infinite. + // @ts-expect-error because of rolldown-vite - completely fine though plugins: [serverSidedVue()], }, }, @@ -255,7 +285,7 @@ export default defineNuxtConfig({ }, }, }, - compatibilityDate: '2024-07-03', + compatibilityDate: '2025-01-01', telemetry: false, }) diff --git a/apps/frontend/package.json b/apps/frontend/package.json index 803e69509..e0720e9a5 100644 --- a/apps/frontend/package.json +++ b/apps/frontend/package.json @@ -10,20 +10,19 @@ "postinstall": "nuxi prepare", "lint": "eslint . && prettier --check .", "fix": "eslint . --fix && prettier --write .", - "intl:extract": "formatjs extract \"{,src/components,src/composables,src/layouts,src/middleware,src/modules,src/pages,src/plugins,src/utils}/**/*.{vue,ts,tsx,js,jsx,mts,cts,mjs,cjs}\" \"src/error.vue\" --ignore \"**/*.d.ts\" --ignore node_modules --out-file src/locales/en-US/index.json --format crowdin --preserve-whitespace", + "intl:extract": "formatjs extract \"src/{components,composables,layouts,middleware,modules,pages,plugins,utils}/**/*.{vue,ts,tsx,js,jsx,mts,cts,mjs,cjs}\" \"src/error.vue\" --ignore \"**/*.d.ts\" --ignore node_modules --out-file src/locales/en-US/index.json --format crowdin --preserve-whitespace", "test": "nuxi build" }, "devDependencies": { "@formatjs/cli": "^6.2.12", - "@nuxt/devtools": "^1.3.3", - "@nuxtjs/i18n": "^8.5.5", + "@modrinth/tooling-config": "workspace:*", + "@nuxtjs/i18n": "^9.0.0", "@types/dompurify": "^3.0.5", "@types/iso-3166-2": "^1.0.4", "@types/node": "^20.1.0", "autoprefixer": "^10.4.19", - "eslint": "^8.57.0", "glob": "^10.2.7", - "nuxt": "^3.14.1592", + "nuxt": "^3.20.2", "postcss": "^8.4.39", "prettier-plugin-tailwindcss": "^0.6.5", "sass": "^1.58.0", @@ -43,11 +42,10 @@ "@modrinth/moderation": "workspace:*", "@modrinth/ui": "workspace:*", "@modrinth/utils": "workspace:*", - "@pinia/nuxt": "^0.5.1", + "@pinia/nuxt": "^0.11.3", "@tanstack/vue-query": "^5.90.7", "@types/three": "^0.172.0", - "intl-messageformat": "^10.7.7", - "@vitejs/plugin-vue": "^5.0.4", + "@vitejs/plugin-vue": "^6.0.3", "@vue-email/components": "^0.0.21", "@vue-email/render": "^0.0.9", "@vueuse/core": "^11.1.0", @@ -58,12 +56,13 @@ "floating-vue": "^5.2.2", "fuse.js": "^6.6.2", "highlight.js": "^11.7.0", + "intl-messageformat": "^10.7.7", "iso-3166-2": "1.0.0", "js-yaml": "^4.1.0", "jszip": "^3.10.1", "markdown-it": "14.1.0", "pathe": "^1.1.2", - "pinia": "^2.1.7", + "pinia": "^3.0.0", "pinia-plugin-persistedstate": "^4.4.1", "prettier": "^3.6.2", "qrcode.vue": "^3.4.0", diff --git a/apps/frontend/src/app.vue b/apps/frontend/src/app.vue index a25d0e634..2cf651352 100644 --- a/apps/frontend/src/app.vue +++ b/apps/frontend/src/app.vue @@ -1,5 +1,6 @@