diff --git a/app/app.config.ts b/app/app.config.ts index f8f3046..a7cbb1a 100644 --- a/app/app.config.ts +++ b/app/app.config.ts @@ -126,8 +126,8 @@ export default defineAppConfig({ 'next.config.ts': 'i-simple-icons-nextjs', astro: 'i-simple-icons:astro', nitro: 'i-unjs-nitro', - md: 'i-custom-comark', - mdc: 'i-custom-comark', + md: 'i-comark-logo', + mdc: 'i-comark-logo', react: 'i-logos-react', html: 'i-vscode-icons-file-type-html', svelte: 'i-logos-svelte-icon', diff --git a/app/assets/icons/comark.svg b/app/assets/icons/logo.svg similarity index 100% rename from app/assets/icons/comark.svg rename to app/assets/icons/logo.svg diff --git a/app/components/content/landing/LandingHeroDemo.vue b/app/components/content/landing/LandingHeroDemo.vue index fccb9fd..5d2e64f 100644 --- a/app/components/content/landing/LandingHeroDemo.vue +++ b/app/components/content/landing/LandingHeroDemo.vue @@ -15,7 +15,7 @@ const plugins = [rangi({ theme: geistTheme })] const sourceAsCode = computed(() => ['````md', props.source, '````'].join('\n')) const tabs = [ - { id: 'source', label: 'source.md', icon: 'i-custom-comark' }, + { id: 'source', label: 'source.md', icon: 'i-comark-logo' }, { id: 'output', label: 'preview', icon: 'i-lucide-eye' }, ] const activeIndex = ref(0) diff --git a/app/plugins/icons.ts b/app/plugins/icons.ts deleted file mode 100644 index 0c8c188..0000000 --- a/app/plugins/icons.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { addIcon } from '@iconify/vue' - -export default defineNuxtPlugin(() => { - addIcon('custom:comark', { - body: '', - width: 198, - height: 198, - }) -}) diff --git a/nuxt.config.ts b/nuxt.config.ts index 9ebdd51..4a58c39 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -65,6 +65,10 @@ export default defineNuxtConfig({ provider: 'server', fallbackToApi: 'client-only', serverBundle: { collections: LAYER_ICON_COLLECTIONS }, + // The layer's own SVGs, used as `i-comark-`. Registered at build time so the server bundle and + // SSR know them: a runtime `addIcon()` only reaches the `@iconify/vue` copy it was imported from, which is + // not the one `@nuxt/icon` renders with when a consumer installs two versions. + customCollections: [{ prefix: 'comark', dir: resolve('./app/assets/icons') }], clientBundle: { scan: true }, }, vite: { diff --git a/package.json b/package.json index fcc813f..b744c60 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,6 @@ "@iconify-json/simple-icons": "^1.2.101", "@iconify-json/unjs": "^1.2.4", "@iconify-json/vscode-icons": "^1.2.96", - "@iconify/vue": "^5.0.5", "@nuxt/kit": "^4.6.4", "@nuxt/ui": "^4.12.0", "@nuxtjs/mcp-toolkit": "^0.24.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 38d484b..743477d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -193,9 +193,6 @@ importers: '@iconify-json/vscode-icons': specifier: ^1.2.96 version: 1.2.96 - '@iconify/vue': - specifier: ^5.0.5 - version: 5.0.5(vue@3.5.44(typescript@6.0.3)) '@nuxt/kit': specifier: ^4.6.4 version: 4.6.4(@nuxt/schema@4.6.4)(confbox@0.3.1)(dotenv@17.4.2)(giget@3.3.1)(jiti@2.7.0)(magic-string@1.4.5)(mlly@1.8.2)(oxc-parser@0.153.0)(rolldown@1.2.15)(unplugin@3.7.0(esbuild@0.28.2)(rolldown@1.2.15)(rollup@4.67.5)(vite@8.3.5(@types/node@26.6.2)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.2)(yaml@2.9.1))) diff --git a/test/e2e/routes.test.ts b/test/e2e/routes.test.ts index 0099608..f86a5b2 100644 --- a/test/e2e/routes.test.ts +++ b/test/e2e/routes.test.ts @@ -72,3 +72,13 @@ describe('agent routes', () => { expect(response.headers.get('content-type')).toContain('text/markdown') }) }) + +describe('icons', () => { + // The icon of `md` code blocks is the layer's own SVG, not an Iconify collection. @nuxt/icon caches the + // JSON error of a missing icon and then answers 200 with it, so the body is what shows it is served. + it('serves the comark logo from the server bundle', async () => { + const response = await fetchPath('/api/_nuxt_icon/comark.json?icons=logo') + const collection = await response.json() as { icons?: Record } + expect(collection.icons?.logo?.body).toContain('