From e1e66b3c679e7bb3da36b806e9a6fde7c9a755fa Mon Sep 17 00:00:00 2001 From: Harlan Wilton Date: Wed, 14 Oct 2026 03:04:38 +1100 Subject: [PATCH 1/2] fix(route-rules): use released Shared types --- pnpm-lock.yaml | 137 ++++++++++++++++-- pnpm-workspace.yaml | 3 +- test/fixtures/nuxt5/nuxt.config.ts | 3 + test/fixtures/nuxt5/package.json | 4 +- test/fixtures/nuxt5/pnpm-lock.yaml | 93 ++---------- test/fixtures/nuxt5/pnpm-workspace.yaml | 2 +- test/fixtures/nuxt5/server/api/compat.get.ts | 6 +- .../nuxt5/server/api/route-rules.get.ts | 17 +++ test/fixtures/nuxt5/test-route-rules.ts | 10 ++ test/fixtures/nuxt5/test.mjs | 2 + 10 files changed, 180 insertions(+), 97 deletions(-) create mode 100644 test/fixtures/nuxt5/server/api/route-rules.get.ts create mode 100644 test/fixtures/nuxt5/test-route-rules.ts diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 272e9134..988f44a9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -233,6 +233,9 @@ catalogs: nuxtseo-layer-devtools: specifier: ^5.3.16 version: 5.3.16 + nuxtseo-shared: + specifier: ^6.0.3 + version: 6.0.3 ofetch: specifier: ^1.5.1 version: 1.5.1 @@ -284,7 +287,6 @@ overrides: cssnano-utils: 8.1.0 nuxt-site-config: https://pkg.pr.new/harlan-zw/nuxt-site-config/nuxt-site-config@b8c8a6978ce818d77ecc50c679d412e748fdbdcb nuxt-site-config-kit: https://pkg.pr.new/harlan-zw/nuxt-site-config/nuxt-site-config-kit@b8c8a6978ce818d77ecc50c679d412e748fdbdcb - nuxtseo-shared: https://pkg.pr.new/harlan-zw/nuxt-seo/nuxtseo-shared@226c091a0744b7286ef721ac035eed53856bfaa5 postcss-calc: 11.2.2 postcss-colormin: 9.0.6 postcss-convert-values: 9.0.7 @@ -336,8 +338,8 @@ importers: specifier: https://pkg.pr.new/harlan-zw/nuxt-site-config/nuxt-site-config@b8c8a6978ce818d77ecc50c679d412e748fdbdcb version: https://pkg.pr.new/harlan-zw/nuxt-site-config/nuxt-site-config@b8c8a6978ce818d77ecc50c679d412e748fdbdcb(afaa1df57659ba9a7b8e0dcaa9451ada) nuxtseo-shared: - specifier: https://pkg.pr.new/harlan-zw/nuxt-seo/nuxtseo-shared@226c091a0744b7286ef721ac035eed53856bfaa5 - version: https://pkg.pr.new/harlan-zw/nuxt-seo/nuxtseo-shared@226c091a0744b7286ef721ac035eed53856bfaa5(6d4538d3862a321412eabdabe7fd6263) + specifier: 'catalog:' + version: 6.0.3(6d4538d3862a321412eabdabe7fd6263) ofetch: specifier: 'catalog:' version: 1.5.1 @@ -1787,6 +1789,36 @@ packages: rolldown: optional: true + '@nuxt/kit@4.6.1': + resolution: {integrity: sha512-ld5+/o4EMqyw6Qy+SdEYkezfprS87+p+xOBhnQgXwyrg1EdtILfLeudQ+hX6UyCnsoF6o0SOw3pjN1P4Tg9O0w==} + engines: {node: ^20.19.0 || >=22.12.0} + peerDependencies: + '@nuxt/schema': ^3.0.0 || ^4.0.0 || ^5.0.0-0 + confbox: '>=0.1.0' + dotenv: '*' + giget: '>=3.1.0' + jiti: ^2.0.0 + mlly: ^1.2.0 + oxc-parser: '>=0.56.0' + rolldown: '>=1.0.0' + peerDependenciesMeta: + '@nuxt/schema': + optional: true + confbox: + optional: true + dotenv: + optional: true + giget: + optional: true + jiti: + optional: true + mlly: + optional: true + oxc-parser: + optional: true + rolldown: + optional: true + '@nuxt/module-builder@1.0.3': resolution: {integrity: sha512-3VApg9j6MUc6G2p5hwUZmYCBHnFPg+18ye1uXpywDQGzS12HM9d1ktsCovBEImeLOLw2PlPOms/gMFkaqxRcuw==} engines: {node: ^18.0.0 || >=20.0.0} @@ -6408,9 +6440,22 @@ packages: nuxtseo-layer-devtools@5.3.16: resolution: {integrity: sha512-pTi0Bsjc22UkE6F1vaUPALUR+OK7922FVqOAawGy4rYcHoOFUNjFn9L5+wTezHZRwv5BX5fTuTkkZFRzusgwUA==} - nuxtseo-shared@https://pkg.pr.new/harlan-zw/nuxt-seo/nuxtseo-shared@226c091a0744b7286ef721ac035eed53856bfaa5: - resolution: {integrity: sha512-z27hJL9wFAXX3n/1MRo6L63RaipeRV08UOl0vSRLdmXGjVmbb12NM9ZuQrvuRO6B79iK3bvUZi7C5JZ8CLfDyg==, tarball: https://pkg.pr.new/harlan-zw/nuxt-seo/nuxtseo-shared@226c091a0744b7286ef721ac035eed53856bfaa5} - version: 6.0.0 + nuxtseo-shared@5.3.16: + resolution: {integrity: sha512-0Ood/aB/6PtWHFx6JB4Ub/InEbilW29cvTFGX5pIWyGf9Wewyil0T4481F/IUhvabHUGssWqErmn+mKoY/z6qA==} + peerDependencies: + '@nuxt/schema': ^3.16.0 || ^4.0.0 || ^5.0.0 + nuxt: ^3.16.0 || ^4.0.0 || ^5.0.0 + nuxt-site-config: ^3.2.0 || ^4.0.0 + vue: ^3.5.0 + zod: ^3.23.0 || ^4.0.0 + peerDependenciesMeta: + nuxt-site-config: + optional: true + zod: + optional: true + + nuxtseo-shared@6.0.3: + resolution: {integrity: sha512-CEpw7RGKS+nzkIDK2ToFXqeUnMF7apgagyq1H4NslVmAJi3/eUL6k2Zvg5T/F4Y4WoL/uvq1XBH0b9+ujAf6iw==} engines: {node: ^22.22.3 || ^24.15.0 || >=26.0.0} peerDependencies: '@nuxt/schema': ^4.6.0 || ^5.0.0 @@ -6551,6 +6596,9 @@ packages: package-manager-detector@1.8.0: resolution: {integrity: sha512-yQA4H19AmPEoMUeavPMDIe1higySl/gH/yaQrkT/s07Qp+7pp2hYz30N3z2l5BkjVkF9Ow6o0wjJamm2y7Sn0A==} + package-manager-detector@1.9.0: + resolution: {integrity: sha512-zAMfbta9nPA8AKkA4WdmNAT8R8s6Dk0/xwPsqNnRidMFcLo1YkLuPDTgs2f64XdzS8vbLNnoJ+uUIkgbz7oRHA==} + pako@1.0.11: resolution: {integrity: sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==} @@ -10505,6 +10553,39 @@ snapshots: - magic-string - unplugin + '@nuxt/kit@4.6.1(@nuxt/schema@4.6.0)(confbox@0.2.4)(dotenv@17.4.2)(giget@3.3.1)(jiti@2.7.0)(magic-string@0.30.21)(mlly@1.8.2)(oxc-parser@0.153.0)(rolldown@1.2.12)(unplugin@3.3.0(esbuild@0.28.2)(rolldown@1.2.12)(rollup@4.62.4)(vite@8.3.3(@types/node@26.2.0)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.50.0)(yaml@2.9.0)))': + dependencies: + consola: 3.4.2 + defu: 6.1.7 + destr: 2.0.5 + errx: 0.2.2 + exsolve: 1.1.3 + ignore: 7.0.12 + klona: 2.0.6 + microdiff: 1.6.0 + nostics: 1.3.0 + package-manager-detector: 1.9.0 + pathe: 2.0.3 + rc9: 3.1.0 + scule: 1.3.0 + std-env: 4.3.0 + tinyexec: 1.3.1 + tinyglobby: 0.2.17 + unctx: 3.0.1(magic-string@0.30.21)(oxc-parser@0.153.0)(rolldown@1.2.12)(unplugin@3.3.0(esbuild@0.28.2)(rolldown@1.2.12)(rollup@4.62.4)(vite@8.3.3(@types/node@26.2.0)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.50.0)(yaml@2.9.0))) + verkit: 0.5.0 + optionalDependencies: + '@nuxt/schema': 4.6.0 + confbox: 0.2.4 + dotenv: 17.4.2 + giget: 3.3.1 + jiti: 2.7.0 + mlly: 1.8.2 + oxc-parser: 0.153.0 + rolldown: 1.2.12 + transitivePeerDependencies: + - magic-string + - unplugin + '@nuxt/module-builder@1.0.3(@nuxt/cli@3.37.0(@nuxt/schema@4.6.0)(commander@14.0.3)(magicast@0.5.4)(supports-color@10.2.2))(@volar/typescript@2.4.28(typescript@6.0.3))(@vue/compiler-core@3.5.43)(@vue/language-core@3.3.10)(esbuild@0.28.2)(rolldown@1.2.12)(rollup@4.62.4)(typescript@6.0.3)(vite@8.3.3(@types/node@26.2.0)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.50.0)(yaml@2.9.0))(vue-tsc@3.3.12(typescript@6.0.3))(vue@3.5.43(typescript@6.0.3))': dependencies: '@nuxt/cli': 3.37.0(@nuxt/schema@4.6.0)(commander@14.0.3)(magicast@0.5.4)(supports-color@10.2.2) @@ -11283,7 +11364,7 @@ snapshots: defu: 6.1.7 nuxt: 4.6.0(@babel/plugin-syntax-jsx@7.29.7(@babel/core@7.29.7(supports-color@10.2.2)))(@babel/plugin-syntax-typescript@7.29.7(@babel/core@7.29.7(supports-color@10.2.2)))(@oxc-project/types@0.146.0)(@types/node@26.2.0)(@vitejs/devtools-kit@0.4.10(srvx@0.11.22)(typescript@6.0.3)(vite@8.3.3(@types/node@26.2.0)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.50.0)(yaml@2.9.0)))(@vue/compiler-sfc@3.5.43)(acorn@8.18.0)(better-sqlite3@13.0.3)(confbox@0.2.4)(db0@0.3.4(better-sqlite3@13.0.3))(dotenv@17.4.2)(esbuild@0.28.2)(eslint@10.12.0(jiti@2.7.0)(supports-color@10.2.2))(giget@3.3.1)(ioredis@5.11.1(supports-color@10.2.2))(lightningcss@1.33.0)(mlly@1.8.2)(optionator@0.9.4)(oxc-parser@0.153.0)(rolldown@1.2.12)(rollup-plugin-visualizer@7.1.1(rolldown@1.2.12)(rollup@4.62.4))(rollup@4.62.4)(srvx@0.11.22)(supports-color@10.2.2)(terser@5.50.0)(typescript@6.0.3)(vite@8.3.3(@types/node@26.2.0)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.50.0)(yaml@2.9.0))(vue-tsc@3.3.12(typescript@6.0.3))(yaml@2.9.0) nuxt-site-config: https://pkg.pr.new/harlan-zw/nuxt-site-config/nuxt-site-config@b8c8a6978ce818d77ecc50c679d412e748fdbdcb(afaa1df57659ba9a7b8e0dcaa9451ada) - nuxtseo-shared: https://pkg.pr.new/harlan-zw/nuxt-seo/nuxtseo-shared@226c091a0744b7286ef721ac035eed53856bfaa5(6d4538d3862a321412eabdabe7fd6263) + nuxtseo-shared: 6.0.3(6d4538d3862a321412eabdabe7fd6263) ufo: 1.6.4 optionalDependencies: zod: 4.6.5 @@ -16022,7 +16103,7 @@ snapshots: defu: 6.1.7 nuxt: 4.6.0(@babel/plugin-syntax-jsx@7.29.7(@babel/core@7.29.7(supports-color@10.2.2)))(@babel/plugin-syntax-typescript@7.29.7(@babel/core@7.29.7(supports-color@10.2.2)))(@oxc-project/types@0.146.0)(@types/node@26.2.0)(@vitejs/devtools-kit@0.4.10(srvx@0.11.22)(typescript@6.0.3)(vite@8.3.3(@types/node@26.2.0)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.50.0)(yaml@2.9.0)))(@vue/compiler-sfc@3.5.43)(acorn@8.18.0)(better-sqlite3@13.0.3)(confbox@0.2.4)(db0@0.3.4(better-sqlite3@13.0.3))(dotenv@17.4.2)(esbuild@0.28.2)(eslint@10.12.0(jiti@2.7.0)(supports-color@10.2.2))(giget@3.3.1)(ioredis@5.11.1(supports-color@10.2.2))(lightningcss@1.33.0)(mlly@1.8.2)(optionator@0.9.4)(oxc-parser@0.153.0)(rolldown@1.2.12)(rollup-plugin-visualizer@7.1.1(rolldown@1.2.12)(rollup@4.62.4))(rollup@4.62.4)(srvx@0.11.22)(supports-color@10.2.2)(terser@5.50.0)(typescript@6.0.3)(vite@8.3.3(@types/node@26.2.0)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.50.0)(yaml@2.9.0))(vue-tsc@3.3.12(typescript@6.0.3))(yaml@2.9.0) nuxt-site-config-kit: https://pkg.pr.new/harlan-zw/nuxt-site-config/nuxt-site-config-kit@b8c8a6978ce818d77ecc50c679d412e748fdbdcb(@nuxt/schema@4.6.0)(confbox@0.2.4)(dotenv@17.4.2)(giget@3.3.1)(jiti@2.7.0)(magic-string@0.30.21)(mlly@1.8.2)(oxc-parser@0.153.0)(rolldown@1.2.12)(unplugin@3.3.0(esbuild@0.28.2)(rolldown@1.2.12)(rollup@4.62.4)(vite@8.3.3(@types/node@26.2.0)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.50.0)(yaml@2.9.0)))(vue@3.5.43(typescript@6.0.3)) - nuxtseo-shared: https://pkg.pr.new/harlan-zw/nuxt-seo/nuxtseo-shared@226c091a0744b7286ef721ac035eed53856bfaa5(6d4538d3862a321412eabdabe7fd6263) + nuxtseo-shared: 6.0.3(6d4538d3862a321412eabdabe7fd6263) site-config-stack: https://pkg.pr.new/harlan-zw/nuxt-site-config/site-config-stack@b8c8a6978ce818d77ecc50c679d412e748fdbdcb(vue@3.5.43(typescript@6.0.3)) ufo: 1.6.4 vue: 3.5.43(typescript@6.0.3) @@ -16355,7 +16436,7 @@ snapshots: '@shikijs/themes': 4.4.3 '@vueuse/core': 14.4.0(vue@3.5.43(typescript@6.0.3)) '@vueuse/nuxt': 14.4.0(3e5a75742883cfb2d3db02a881b685aa) - nuxtseo-shared: https://pkg.pr.new/harlan-zw/nuxt-seo/nuxtseo-shared@226c091a0744b7286ef721ac035eed53856bfaa5(6d4538d3862a321412eabdabe7fd6263) + nuxtseo-shared: 5.3.16(7ab18bc7f1604380b01ba715b44ebe3b) ofetch: 1.5.1 shiki: 4.4.3 tailwindcss: 4.3.3 @@ -16448,10 +16529,44 @@ snapshots: - yup - zod - nuxtseo-shared@https://pkg.pr.new/harlan-zw/nuxt-seo/nuxtseo-shared@226c091a0744b7286ef721ac035eed53856bfaa5(6d4538d3862a321412eabdabe7fd6263): + nuxtseo-shared@5.3.16(7ab18bc7f1604380b01ba715b44ebe3b): dependencies: + '@clack/prompts': 1.8.1 + '@nuxt/devtools-kit': 4.0.0-alpha.7(@nuxt/schema@4.6.0)(confbox@0.2.4)(dotenv@17.4.2)(giget@3.3.1)(jiti@2.7.0)(magic-string@0.30.21)(mlly@1.8.2)(oxc-parser@0.153.0)(rolldown@1.2.12)(unplugin@3.3.0(esbuild@0.28.2)(rolldown@1.2.12)(rollup@4.62.4)(vite@8.3.3(@types/node@26.2.0)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.50.0)(yaml@2.9.0)))(vite@8.3.3(@types/node@26.2.0)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.50.0)(yaml@2.9.0)) '@nuxt/kit': 4.6.0(@nuxt/schema@4.6.0)(confbox@0.2.4)(dotenv@17.4.2)(giget@3.3.1)(jiti@2.7.0)(magic-string@0.30.21)(mlly@1.8.2)(oxc-parser@0.153.0)(rolldown@1.2.12)(unplugin@3.3.0(esbuild@0.28.2)(rolldown@1.2.12)(rollup@4.62.4)(vite@8.3.3(@types/node@26.2.0)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.50.0)(yaml@2.9.0))) '@nuxt/schema': 4.6.0 + birpc: 4.2.0 + consola: 3.4.2 + defu: 6.1.7 + nuxt: 4.6.0(@babel/plugin-syntax-jsx@7.29.7(@babel/core@7.29.7(supports-color@10.2.2)))(@babel/plugin-syntax-typescript@7.29.7(@babel/core@7.29.7(supports-color@10.2.2)))(@oxc-project/types@0.146.0)(@types/node@26.2.0)(@vitejs/devtools-kit@0.4.10(srvx@0.11.22)(typescript@6.0.3)(vite@8.3.3(@types/node@26.2.0)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.50.0)(yaml@2.9.0)))(@vue/compiler-sfc@3.5.43)(acorn@8.18.0)(better-sqlite3@13.0.3)(confbox@0.2.4)(db0@0.3.4(better-sqlite3@13.0.3))(dotenv@17.4.2)(esbuild@0.28.2)(eslint@10.12.0(jiti@2.7.0)(supports-color@10.2.2))(giget@3.3.1)(ioredis@5.11.1(supports-color@10.2.2))(lightningcss@1.33.0)(mlly@1.8.2)(optionator@0.9.4)(oxc-parser@0.153.0)(rolldown@1.2.12)(rollup-plugin-visualizer@7.1.1(rolldown@1.2.12)(rollup@4.62.4))(rollup@4.62.4)(srvx@0.11.22)(supports-color@10.2.2)(terser@5.50.0)(typescript@6.0.3)(vite@8.3.3(@types/node@26.2.0)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.50.0)(yaml@2.9.0))(vue-tsc@3.3.12(typescript@6.0.3))(yaml@2.9.0) + nypm: 0.6.10 + ofetch: 1.5.1 + pathe: 2.0.3 + pkg-types: 2.3.3 + radix3: 1.1.2 + sirv: 3.0.2 + std-env: 4.3.0 + ufo: 1.6.4 + vue: 3.5.43(typescript@6.0.3) + optionalDependencies: + nuxt-site-config: https://pkg.pr.new/harlan-zw/nuxt-site-config/nuxt-site-config@b8c8a6978ce818d77ecc50c679d412e748fdbdcb(afaa1df57659ba9a7b8e0dcaa9451ada) + zod: 4.6.5 + transitivePeerDependencies: + - confbox + - dotenv + - giget + - jiti + - magic-string + - mlly + - oxc-parser + - rolldown + - unplugin + - vite + + nuxtseo-shared@6.0.3(6d4538d3862a321412eabdabe7fd6263): + dependencies: + '@nuxt/kit': 4.6.1(@nuxt/schema@4.6.0)(confbox@0.2.4)(dotenv@17.4.2)(giget@3.3.1)(jiti@2.7.0)(magic-string@0.30.21)(mlly@1.8.2)(oxc-parser@0.153.0)(rolldown@1.2.12)(unplugin@3.3.0(esbuild@0.28.2)(rolldown@1.2.12)(rollup@4.62.4)(vite@8.3.3(@types/node@26.2.0)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.50.0)(yaml@2.9.0))) + '@nuxt/schema': 4.6.0 consola: 3.4.2 defu: 6.1.7 nuxt: 4.6.0(@babel/plugin-syntax-jsx@7.29.7(@babel/core@7.29.7(supports-color@10.2.2)))(@babel/plugin-syntax-typescript@7.29.7(@babel/core@7.29.7(supports-color@10.2.2)))(@oxc-project/types@0.146.0)(@types/node@26.2.0)(@vitejs/devtools-kit@0.4.10(srvx@0.11.22)(typescript@6.0.3)(vite@8.3.3(@types/node@26.2.0)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.50.0)(yaml@2.9.0)))(@vue/compiler-sfc@3.5.43)(acorn@8.18.0)(better-sqlite3@13.0.3)(confbox@0.2.4)(db0@0.3.4(better-sqlite3@13.0.3))(dotenv@17.4.2)(esbuild@0.28.2)(eslint@10.12.0(jiti@2.7.0)(supports-color@10.2.2))(giget@3.3.1)(ioredis@5.11.1(supports-color@10.2.2))(lightningcss@1.33.0)(mlly@1.8.2)(optionator@0.9.4)(oxc-parser@0.153.0)(rolldown@1.2.12)(rollup-plugin-visualizer@7.1.1(rolldown@1.2.12)(rollup@4.62.4))(rollup@4.62.4)(srvx@0.11.22)(supports-color@10.2.2)(terser@5.50.0)(typescript@6.0.3)(vite@8.3.3(@types/node@26.2.0)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.50.0)(yaml@2.9.0))(vue-tsc@3.3.12(typescript@6.0.3))(yaml@2.9.0) @@ -16680,6 +16795,8 @@ snapshots: package-manager-detector@1.8.0: {} + package-manager-detector@1.9.0: {} + pako@1.0.11: {} parse-entities@4.0.2: diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index d1821ee8..f57f0436 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -75,7 +75,6 @@ overrides: cssnano-utils: 8.1.0 nuxt-site-config: https://pkg.pr.new/harlan-zw/nuxt-site-config/nuxt-site-config@b8c8a6978ce818d77ecc50c679d412e748fdbdcb nuxt-site-config-kit: https://pkg.pr.new/harlan-zw/nuxt-site-config/nuxt-site-config-kit@b8c8a6978ce818d77ecc50c679d412e748fdbdcb - nuxtseo-shared: https://pkg.pr.new/harlan-zw/nuxt-seo/nuxtseo-shared@226c091a0744b7286ef721ac035eed53856bfaa5 postcss-calc: 11.2.2 postcss-colormin: 9.0.6 @@ -152,7 +151,7 @@ catalog: nuxt-i18n-micro: ^3.30.0 nuxt-site-config: ^5.0.0 nuxtseo-layer-devtools: ^5.3.16 - nuxtseo-shared: ^6.0.0 + nuxtseo-shared: ^6.0.3 ofetch: ^1.5.1 ohash: ^2.0.11 oxc-parser: ^0.153.0 diff --git a/test/fixtures/nuxt5/nuxt.config.ts b/test/fixtures/nuxt5/nuxt.config.ts index 6531233a..c7197dad 100644 --- a/test/fixtures/nuxt5/nuxt.config.ts +++ b/test/fixtures/nuxt5/nuxt.config.ts @@ -21,6 +21,9 @@ export default defineNuxtConfig({ sources: [['/api/source', { headers: { authorization: 'Bearer fixture' }, query: { locale: 'en' } }]], }, routeRules: { + '/api/route-rules': { + sitemap: { priority: 0.3, changefreq: 'yearly' }, + }, '/excluded': { sitemap: false, }, diff --git a/test/fixtures/nuxt5/package.json b/test/fixtures/nuxt5/package.json index 7f3d710b..06f69fee 100644 --- a/test/fixtures/nuxt5/package.json +++ b/test/fixtures/nuxt5/package.json @@ -4,13 +4,13 @@ "type": "module", "packageManager": "pnpm@12.8.1", "scripts": { - "test": "nuxt cleanup && nuxt prepare && vue-tsc --noEmit -p .nuxt/tsconfig.app.json && vue-tsc --noEmit -p .nuxt/tsconfig.server.json && node --experimental-strip-types test-dev.ts && nuxt build && node test.mjs && nuxt cleanup && nuxt generate && node test-generate.mjs" + "test": "nuxt cleanup && nuxt prepare && vue-tsc --noEmit -p .nuxt/tsconfig.app.json && vue-tsc --noEmit -p .nuxt/tsconfig.node.json && vue-tsc --noEmit -p .nuxt/tsconfig.server.json && node --experimental-strip-types test-dev.ts && nuxt build && node test.mjs && nuxt cleanup && nuxt generate && node test-generate.mjs" }, "dependencies": { "@nuxtjs/sitemap": "link:../../..", "nitro": "3.0.260903-beta", "nuxt-site-config": "^5.0.0", - "nuxtseo-shared": "^6.0.0", + "nuxtseo-shared": "^6.0.3", "nuxt": "npm:nuxt-nightly@5.0.0-2610061032-c7ad8cd", "vue": "^3.5.43", "vue-router": "^5.3.1" diff --git a/test/fixtures/nuxt5/pnpm-lock.yaml b/test/fixtures/nuxt5/pnpm-lock.yaml index 7bd2348b..3e9eca8a 100644 --- a/test/fixtures/nuxt5/pnpm-lock.yaml +++ b/test/fixtures/nuxt5/pnpm-lock.yaml @@ -199,7 +199,7 @@ overrides: nuxt-site-config: https://pkg.pr.new/harlan-zw/nuxt-site-config/nuxt-site-config@40698727ca424460013f3534af9005e36728d669 nuxt-site-config-kit: https://pkg.pr.new/harlan-zw/nuxt-site-config/nuxt-site-config-kit@40698727ca424460013f3534af9005e36728d669 site-config-stack: https://pkg.pr.new/harlan-zw/nuxt-site-config/site-config-stack@40698727ca424460013f3534af9005e36728d669 - nuxtseo-shared: https://pkg.pr.new/harlan-zw/nuxt-seo/nuxtseo-shared@113287e3fb44472264dd56fc90fb695ff8a9f6dd + nuxtseo-shared: ^6.0.3 sitemapd: link:../../../packages/sitemapd '@nuxtjs/robots': https://pkg.pr.new/nuxt-modules/robots/@nuxtjs/robots@31e54738c7afba269ab6ba53fa0113d4e31e1f01 @@ -220,8 +220,8 @@ importers: specifier: https://pkg.pr.new/harlan-zw/nuxt-site-config/nuxt-site-config@40698727ca424460013f3534af9005e36728d669 version: https://pkg.pr.new/harlan-zw/nuxt-site-config/nuxt-site-config@40698727ca424460013f3534af9005e36728d669(1adc39efc93495e8d36852e0358444b9) nuxtseo-shared: - specifier: https://pkg.pr.new/harlan-zw/nuxt-seo/nuxtseo-shared@113287e3fb44472264dd56fc90fb695ff8a9f6dd - version: https://pkg.pr.new/harlan-zw/nuxt-seo/nuxtseo-shared@113287e3fb44472264dd56fc90fb695ff8a9f6dd(d87dbd9295b05765f2d6eae4938e18fe) + specifier: ^6.0.3 + version: 6.0.3(d87dbd9295b05765f2d6eae4938e18fe) vue: specifier: ^3.5.43 version: 3.5.43(typescript@6.0.3) @@ -440,8 +440,8 @@ packages: resolution: {integrity: sha512-+6b0LdsQLmHsvS7J6sQJ4weTpzUn61fU1JKS+321/+IyDYoHW5CR2Tgqcs6GgAAQvlesCo6yX3xttgmx+XGtJw==} engines: {node: '>=20'} - '@nuxt/cli-nightly@4.0.1-2610110855-760dbdb': - resolution: {integrity: sha512-P8hH3llN5RFlmnpa+/QZ+8jA5xnfg+q4iDyN59FPYDb0eyK71UXI3ZK8auA/RB2SNoPTybhlik0qy1VUzL/zhQ==} + '@nuxt/cli-nightly@4.0.1-2610121054-bb805cd': + resolution: {integrity: sha512-jU+XTHHS/X8FQpZ3ZTZ6yn4KXQae6PGTcUPaHuDZm5FpLvfRz6GAxmtV2s+508RPkcEVZVrQqn+BH4R4XEntTA==} engines: {node: ^22.21.0 || ^24.11.0 || >=26.0.0} hasBin: true peerDependencies: @@ -530,36 +530,6 @@ packages: rolldown: optional: true - '@nuxt/kit@4.6.0': - resolution: {integrity: sha512-UXTajJ+MFJgwV9UL1CTNNd2PSw5PC3Pjb2rM7FsSYcr92ySQKXEslBnUKbvnXT+gG3NbZ/EF70+WenoNIHX2tw==} - engines: {node: ^20.19.0 || >=22.12.0} - peerDependencies: - '@nuxt/schema': ^3.0.0 || ^4.0.0 || ^5.0.0-0 - confbox: '>=0.1.0' - dotenv: '*' - giget: '>=3.1.0' - jiti: ^2.0.0 - mlly: ^1.2.0 - oxc-parser: '>=0.56.0' - rolldown: '>=1.0.0' - peerDependenciesMeta: - '@nuxt/schema': - optional: true - confbox: - optional: true - dotenv: - optional: true - giget: - optional: true - jiti: - optional: true - mlly: - optional: true - oxc-parser: - optional: true - rolldown: - optional: true - '@nuxt/kit@4.6.1': resolution: {integrity: sha512-ld5+/o4EMqyw6Qy+SdEYkezfprS87+p+xOBhnQgXwyrg1EdtILfLeudQ+hX6UyCnsoF6o0SOw3pjN1P4Tg9O0w==} engines: {node: ^20.19.0 || >=22.12.0} @@ -1352,9 +1322,8 @@ packages: nuxt: ^4.6.0 || ^5.0.0 vue: ^3.5.43 - nuxtseo-shared@https://pkg.pr.new/harlan-zw/nuxt-seo/nuxtseo-shared@113287e3fb44472264dd56fc90fb695ff8a9f6dd: - resolution: {integrity: sha512-6/hYql9HDKeRiOord8nWW1o5dHHK1nGrrloJW1rt7dTL1R1TBlcDEV/EzqxWUwgy7XG3nCnvZRG55aIXmYkeYA==, tarball: https://pkg.pr.new/harlan-zw/nuxt-seo/nuxtseo-shared@113287e3fb44472264dd56fc90fb695ff8a9f6dd} - version: 6.0.0 + nuxtseo-shared@6.0.3: + resolution: {integrity: sha512-CEpw7RGKS+nzkIDK2ToFXqeUnMF7apgagyq1H4NslVmAJi3/eUL6k2Zvg5T/F4Y4WoL/uvq1XBH0b9+ujAf6iw==} engines: {node: ^22.22.3 || ^24.15.0 || >=26.0.0} peerDependencies: '@nuxt/schema': ^4.6.0 || ^5.0.0 @@ -2040,7 +2009,7 @@ snapshots: '@dxup/nuxt@0.5.10(@nuxt/schema-nightly@5.0.0-2610061032-c7ad8cd)(confbox@0.3.1)(dotenv@17.4.2)(giget@3.3.1)(jiti@2.7.0)(mlly@1.8.2)(rolldown@1.2.12)(vite@8.3.3)': dependencies: '@dxup/unimport': 0.1.2 - '@nuxt/kit': 4.6.0(@nuxt/schema-nightly@5.0.0-2610061032-c7ad8cd)(confbox@0.3.1)(dotenv@17.4.2)(giget@3.3.1)(jiti@2.7.0)(magic-string@1.4.3)(mlly@1.8.2)(rolldown@1.2.12)(unplugin@3.4.0(rolldown@1.2.12)(vite@8.3.3)) + '@nuxt/kit': 4.6.1(@nuxt/schema-nightly@5.0.0-2610061032-c7ad8cd)(confbox@0.3.1)(dotenv@17.4.2)(giget@3.3.1)(jiti@2.7.0)(magic-string@1.4.3)(mlly@1.8.2)(rolldown@1.2.12)(unplugin@3.4.0(rolldown@1.2.12)(vite@8.3.3)) '@vue/compiler-dom': 3.5.43 chokidar: 5.0.0 knitwork: 1.3.0 @@ -2111,7 +2080,7 @@ snapshots: '@modelcontextprotocol/core': 2.3.0 zod: 4.6.5 - '@nuxt/cli-nightly@4.0.1-2610110855-760dbdb(@nuxt/schema-nightly@5.0.0-2610061032-c7ad8cd)(jiti@2.7.0)(rolldown@1.2.12)(vite@8.3.3)': + '@nuxt/cli-nightly@4.0.1-2610121054-bb805cd(@nuxt/schema-nightly@5.0.0-2610061032-c7ad8cd)(jiti@2.7.0)(rolldown@1.2.12)(vite@8.3.3)': dependencies: '@clack/prompts': 1.8.1 args-tokenizer: 0.3.0 @@ -2266,7 +2235,7 @@ snapshots: - magic-string - unplugin - '@nuxt/kit@4.6.0(@nuxt/schema-nightly@5.0.0-2610061032-c7ad8cd)(confbox@0.3.1)(dotenv@17.4.2)(giget@3.3.1)(jiti@2.7.0)(magic-string@1.4.3)(mlly@1.8.2)(rolldown@1.2.12)(unplugin@3.4.0(rolldown@1.2.12)(vite@8.3.3))': + '@nuxt/kit@4.6.1(@nuxt/schema-nightly@5.0.0-2610061032-c7ad8cd)(confbox@0.3.1)(dotenv@17.4.2)(giget@3.3.1)(jiti@2.7.0)(magic-string@1.4.3)(mlly@1.8.2)(rolldown@1.2.12)(unplugin@3.4.0(rolldown@1.2.12)(vite@8.3.3))': dependencies: consola: 3.4.2 defu: 6.1.7 @@ -2298,38 +2267,6 @@ snapshots: - magic-string - unplugin - '@nuxt/kit@4.6.0(@nuxt/schema@4.6.0)(confbox@0.3.1)(dotenv@17.4.2)(giget@3.3.1)(jiti@2.7.0)(magic-string@1.4.3)(mlly@1.8.2)(rolldown@1.2.12)(unplugin@3.4.0(rolldown@1.2.12)(vite@8.3.3))': - dependencies: - consola: 3.4.2 - defu: 6.1.7 - destr: 2.0.5 - errx: 0.2.2 - exsolve: 1.1.3 - ignore: 7.0.12 - klona: 2.0.6 - microdiff: 1.6.0 - nostics: 1.3.0 - package-manager-detector: 1.9.0 - pathe: 2.0.3 - rc9: 3.1.0 - scule: 1.3.0 - std-env: 4.3.0 - tinyexec: 1.3.1 - tinyglobby: 0.2.17 - unctx: 3.0.1(magic-string@1.4.3)(rolldown@1.2.12)(unplugin@3.4.0(rolldown@1.2.12)(vite@8.3.3)) - verkit: 0.5.0 - optionalDependencies: - '@nuxt/schema': 4.6.0 - confbox: 0.3.1 - dotenv: 17.4.2 - giget: 3.3.1 - jiti: 2.7.0 - mlly: 1.8.2 - rolldown: 1.2.12 - transitivePeerDependencies: - - magic-string - - unplugin - '@nuxt/kit@4.6.1(@nuxt/schema@4.6.0)(confbox@0.3.1)(dotenv@17.4.2)(giget@3.3.1)(jiti@2.7.0)(magic-string@1.4.3)(mlly@1.8.2)(rolldown@1.2.12)(unplugin@3.4.0(rolldown@1.2.12)(vite@8.3.3))': dependencies: consola: 3.4.2 @@ -3159,7 +3096,7 @@ snapshots: dependencies: '@dxup/nuxt': 0.5.10(@nuxt/schema-nightly@5.0.0-2610061032-c7ad8cd)(confbox@0.3.1)(dotenv@17.4.2)(giget@3.3.1)(jiti@2.7.0)(mlly@1.8.2)(rolldown@1.2.12)(vite@8.3.3) '@jridgewell/trace-mapping': 0.3.31 - '@nuxt/cli': '@nuxt/cli-nightly@4.0.1-2610110855-760dbdb(@nuxt/schema-nightly@5.0.0-2610061032-c7ad8cd)(jiti@2.7.0)(rolldown@1.2.12)(vite@8.3.3)' + '@nuxt/cli': '@nuxt/cli-nightly@4.0.1-2610121054-bb805cd(@nuxt/schema-nightly@5.0.0-2610061032-c7ad8cd)(jiti@2.7.0)(rolldown@1.2.12)(vite@8.3.3)' '@nuxt/devtools': 4.0.0-beta.3(@devframes/agentic@1.2.0)(@devframes/hub-ui@1.2.0(@devframes/hub@1.2.0(@devframes/agentic@1.2.0)(crossws@0.4.12(srvx@1.0.5))(devframe@1.2.0)(ocache@0.3.0))(@devframes/json-render@1.2.0(@devframes/hub@1.2.0(@devframes/agentic@1.2.0)(crossws@0.4.12(srvx@1.0.5))(devframe@1.2.0)(ocache@0.3.0))(devframe@1.2.0))(devframe@1.2.0))(@devframes/json-render@1.2.0(@devframes/hub@1.2.0(@devframes/agentic@1.2.0)(crossws@0.4.12(srvx@1.0.5))(devframe@1.2.0)(ocache@0.3.0))(devframe@1.2.0))(@nuxt/kit-nightly@5.0.0-2610061032-c7ad8cd(@nuxt/schema-nightly@5.0.0-2610061032-c7ad8cd)(confbox@0.3.1)(dotenv@17.4.2)(giget@3.3.1)(jiti@2.7.0)(magic-string@1.4.3)(mlly@1.8.2)(rolldown@1.2.12)(unplugin@3.4.0(rolldown@1.2.12)(vite@8.3.3)))(cac@7.0.0)(crossws@0.4.12(srvx@1.0.5))(db0@0.4.1)(nitro@3.0.260903-beta)(ocache@0.3.0)(rolldown@1.2.12)(srvx@1.0.5)(vite@8.3.3)(vue@3.5.43(typescript@6.0.3)) '@nuxt/kit': '@nuxt/kit-nightly@5.0.0-2610061032-c7ad8cd(@nuxt/schema-nightly@5.0.0-2610061032-c7ad8cd)(confbox@0.3.1)(dotenv@17.4.2)(giget@3.3.1)(jiti@2.7.0)(magic-string@1.4.3)(mlly@1.8.2)(rolldown@1.2.12)(unplugin@3.4.0(rolldown@1.2.12)(vite@8.3.3))' '@nuxt/nitro-server': '@nuxt/nitro-server-nightly@5.0.0-2610061032-c7ad8cd(a8f6a9e15717c4e8b00bfb03a9d672f5)' @@ -3316,7 +3253,7 @@ snapshots: nuxt-site-config-kit@https://pkg.pr.new/harlan-zw/nuxt-site-config/nuxt-site-config-kit@40698727ca424460013f3534af9005e36728d669(@nuxt/schema@4.6.0)(confbox@0.3.1)(dotenv@17.4.2)(giget@3.3.1)(jiti@2.7.0)(magic-string@1.4.3)(mlly@1.8.2)(rolldown@1.2.12)(unplugin@3.4.0(rolldown@1.2.12)(vite@8.3.3))(vue@3.5.43(typescript@6.0.3)): dependencies: - '@nuxt/kit': 4.6.0(@nuxt/schema@4.6.0)(confbox@0.3.1)(dotenv@17.4.2)(giget@3.3.1)(jiti@2.7.0)(magic-string@1.4.3)(mlly@1.8.2)(rolldown@1.2.12)(unplugin@3.4.0(rolldown@1.2.12)(vite@8.3.3)) + '@nuxt/kit': 4.6.1(@nuxt/schema@4.6.0)(confbox@0.3.1)(dotenv@17.4.2)(giget@3.3.1)(jiti@2.7.0)(magic-string@1.4.3)(mlly@1.8.2)(rolldown@1.2.12)(unplugin@3.4.0(rolldown@1.2.12)(vite@8.3.3)) site-config-stack: https://pkg.pr.new/harlan-zw/nuxt-site-config/site-config-stack@40698727ca424460013f3534af9005e36728d669(vue@3.5.43(typescript@6.0.3)) ufo: 1.6.4 transitivePeerDependencies: @@ -3335,12 +3272,12 @@ snapshots: nuxt-site-config@https://pkg.pr.new/harlan-zw/nuxt-site-config/nuxt-site-config@40698727ca424460013f3534af9005e36728d669(1adc39efc93495e8d36852e0358444b9): dependencies: '@nuxt/devalue': 2.0.2 - '@nuxt/kit': 4.6.0(@nuxt/schema@4.6.0)(confbox@0.3.1)(dotenv@17.4.2)(giget@3.3.1)(jiti@2.7.0)(magic-string@1.4.3)(mlly@1.8.2)(rolldown@1.2.12)(unplugin@3.4.0(rolldown@1.2.12)(vite@8.3.3)) + '@nuxt/kit': 4.6.1(@nuxt/schema@4.6.0)(confbox@0.3.1)(dotenv@17.4.2)(giget@3.3.1)(jiti@2.7.0)(magic-string@1.4.3)(mlly@1.8.2)(rolldown@1.2.12)(unplugin@3.4.0(rolldown@1.2.12)(vite@8.3.3)) consola: 3.4.2 defu: 6.1.7 nuxt: nuxt-nightly@5.0.0-2610061032-c7ad8cd(@devframes/agentic@1.2.0)(@devframes/hub-ui@1.2.0(@devframes/hub@1.2.0(@devframes/agentic@1.2.0)(crossws@0.4.12(srvx@1.0.5))(devframe@1.2.0)(ocache@0.3.0))(@devframes/json-render@1.2.0(@devframes/hub@1.2.0(@devframes/agentic@1.2.0)(crossws@0.4.12(srvx@1.0.5))(devframe@1.2.0)(ocache@0.3.0))(devframe@1.2.0))(devframe@1.2.0))(@devframes/json-render@1.2.0(@devframes/hub@1.2.0(@devframes/agentic@1.2.0)(crossws@0.4.12(srvx@1.0.5))(devframe@1.2.0)(ocache@0.3.0))(devframe@1.2.0))(@oxc-project/types@0.152.0)(@vitejs/devtools@0.7.6)(@vue/compiler-sfc@3.5.43)(acorn@8.18.0)(cac@7.0.0)(confbox@0.3.1)(crossws@0.4.12(srvx@1.0.5))(db0@0.4.1)(dotenv@17.4.2)(giget@3.3.1)(jiti@2.7.0)(lightningcss@1.33.0)(mlly@1.8.2)(nitro@3.0.260903-beta)(nuxt-nightly@5.0.0-2610061032-c7ad8cd)(ocache@0.3.0)(rolldown@1.2.12)(srvx@1.0.5)(typescript@6.0.3)(vite@8.3.3)(vue-tsc@3.3.12(typescript@6.0.3)) nuxt-site-config-kit: https://pkg.pr.new/harlan-zw/nuxt-site-config/nuxt-site-config-kit@40698727ca424460013f3534af9005e36728d669(@nuxt/schema@4.6.0)(confbox@0.3.1)(dotenv@17.4.2)(giget@3.3.1)(jiti@2.7.0)(magic-string@1.4.3)(mlly@1.8.2)(rolldown@1.2.12)(unplugin@3.4.0(rolldown@1.2.12)(vite@8.3.3))(vue@3.5.43(typescript@6.0.3)) - nuxtseo-shared: https://pkg.pr.new/harlan-zw/nuxt-seo/nuxtseo-shared@113287e3fb44472264dd56fc90fb695ff8a9f6dd(d87dbd9295b05765f2d6eae4938e18fe) + nuxtseo-shared: 6.0.3(d87dbd9295b05765f2d6eae4938e18fe) site-config-stack: https://pkg.pr.new/harlan-zw/nuxt-site-config/site-config-stack@40698727ca424460013f3534af9005e36728d669(vue@3.5.43(typescript@6.0.3)) ufo: 1.6.4 vue: 3.5.43(typescript@6.0.3) @@ -3357,7 +3294,7 @@ snapshots: - unplugin - zod - nuxtseo-shared@https://pkg.pr.new/harlan-zw/nuxt-seo/nuxtseo-shared@113287e3fb44472264dd56fc90fb695ff8a9f6dd(d87dbd9295b05765f2d6eae4938e18fe): + nuxtseo-shared@6.0.3(d87dbd9295b05765f2d6eae4938e18fe): dependencies: '@nuxt/kit': 4.6.1(@nuxt/schema@4.6.0)(confbox@0.3.1)(dotenv@17.4.2)(giget@3.3.1)(jiti@2.7.0)(magic-string@1.4.3)(mlly@1.8.2)(rolldown@1.2.12)(unplugin@3.4.0(rolldown@1.2.12)(vite@8.3.3)) '@nuxt/schema': 4.6.0 diff --git a/test/fixtures/nuxt5/pnpm-workspace.yaml b/test/fixtures/nuxt5/pnpm-workspace.yaml index 64989f71..e9b3fbdf 100644 --- a/test/fixtures/nuxt5/pnpm-workspace.yaml +++ b/test/fixtures/nuxt5/pnpm-workspace.yaml @@ -108,7 +108,7 @@ overrides: nuxt-site-config: https://pkg.pr.new/harlan-zw/nuxt-site-config/nuxt-site-config@40698727ca424460013f3534af9005e36728d669 nuxt-site-config-kit: https://pkg.pr.new/harlan-zw/nuxt-site-config/nuxt-site-config-kit@40698727ca424460013f3534af9005e36728d669 site-config-stack: https://pkg.pr.new/harlan-zw/nuxt-site-config/site-config-stack@40698727ca424460013f3534af9005e36728d669 - nuxtseo-shared: https://pkg.pr.new/harlan-zw/nuxt-seo/nuxtseo-shared@113287e3fb44472264dd56fc90fb695ff8a9f6dd + nuxtseo-shared: ^6.0.3 sitemapd: link:../../../packages/sitemapd "@nuxtjs/robots": https://pkg.pr.new/nuxt-modules/robots/@nuxtjs/robots@31e54738c7afba269ab6ba53fa0113d4e31e1f01 onlyBuiltDependencies: diff --git a/test/fixtures/nuxt5/server/api/compat.get.ts b/test/fixtures/nuxt5/server/api/compat.get.ts index f95b741d..1d5b1715 100644 --- a/test/fixtures/nuxt5/server/api/compat.get.ts +++ b/test/fixtures/nuxt5/server/api/compat.get.ts @@ -1,10 +1,8 @@ -import type { AppRouteRules } from 'nuxt/server' +import type { NitroRouteConfig } from 'nitro/types' import { defineEventHandler } from 'nuxt/server' -type SitemapRouteConfig = AppRouteRules & { sitemap?: boolean } - const routeRule = { sitemap: false, -} satisfies SitemapRouteConfig +} satisfies NitroRouteConfig export default defineEventHandler(() => routeRule) diff --git a/test/fixtures/nuxt5/server/api/route-rules.get.ts b/test/fixtures/nuxt5/server/api/route-rules.get.ts new file mode 100644 index 00000000..36488c0b --- /dev/null +++ b/test/fixtures/nuxt5/server/api/route-rules.get.ts @@ -0,0 +1,17 @@ +import type { NitroRouteConfig, NitroRouteRules } from 'nitro/types' +import { getRouteRules } from 'nitro/app' +import { defineEventHandler } from 'nuxt/server' + +const routeConfig = { + sitemap: { priority: 0.3, changefreq: 'yearly' }, +} satisfies NitroRouteConfig + +export default defineEventHandler((event) => { + const routeRules = { + sitemap: getRouteRules(event.req.method, event.url.pathname).routeRules.sitemap, + } satisfies NitroRouteRules + return { + config: routeConfig.sitemap, + resolved: routeRules.sitemap, + } +}) diff --git a/test/fixtures/nuxt5/test-route-rules.ts b/test/fixtures/nuxt5/test-route-rules.ts new file mode 100644 index 00000000..8a53ec1c --- /dev/null +++ b/test/fixtures/nuxt5/test-route-rules.ts @@ -0,0 +1,10 @@ +import assert from 'node:assert/strict' + +export async function assertRouteRules(origin: string) { + const response = await fetch(`${origin}/api/route-rules`) + assert.equal(response.status, 200) + assert.deepEqual(await response.json(), { + config: { priority: 0.3, changefreq: 'yearly' }, + resolved: { priority: 0.3, changefreq: 'yearly' }, + }) +} diff --git a/test/fixtures/nuxt5/test.mjs b/test/fixtures/nuxt5/test.mjs index 64a47806..45bf88c0 100644 --- a/test/fixtures/nuxt5/test.mjs +++ b/test/fixtures/nuxt5/test.mjs @@ -3,6 +3,7 @@ import { spawn } from 'node:child_process' import { once } from 'node:events' import { readFile } from 'node:fs/promises' import { createServer } from 'node:net' +import { assertRouteRules } from './test-route-rules.ts' const portServer = createServer() portServer.listen(0, '127.0.0.1') @@ -37,6 +38,7 @@ async function waitForServer() { try { const response = await waitForServer() + await assertRouteRules(origin) assert.equal(response.headers.get('content-encoding'), 'gzip') assert.match(response.headers.get('vary') || '', /accept-encoding/i) const sitemap = await response.text() From 2d48c6083b8f59e11b8cb532be8cfc33698ce834 Mon Sep 17 00:00:00 2001 From: Harlan Wilton Date: Wed, 14 Oct 2026 03:25:21 +1100 Subject: [PATCH 2/2] fix(route-rules): use Nuxt server primitives --- src/templates.ts | 6 ++++++ test/fixtures/nuxt5/server/api/alias.ts | 6 +++--- test/fixtures/nuxt5/server/api/compat.get.ts | 4 ++-- test/fixtures/nuxt5/server/api/route-rules.get.ts | 14 ++++++-------- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/templates.ts b/src/templates.ts index a5d1da7c..cbc88516 100644 --- a/src/templates.ts +++ b/src/templates.ts @@ -28,6 +28,12 @@ export function registerTypeTemplates(nitroCompatibility: NitroRuntimeCompatibil /// import type { SitemapUrl, SitemapItemDefaults, SitemapIndexRenderCtx, SitemapInputCtx, SitemapRenderCtx, SitemapOutputHookCtx, SitemapSourcesHookCtx, SitemapsResolvedCtx } from '@nuxtjs/sitemap' +declare module '@nuxt/schema' { + interface AppRouteRulesExtensions { + ${routeRules} + } +} + ${nitroTypes} declare module 'vue-router' { diff --git a/test/fixtures/nuxt5/server/api/alias.ts b/test/fixtures/nuxt5/server/api/alias.ts index d643825c..bf6566cb 100644 --- a/test/fixtures/nuxt5/server/api/alias.ts +++ b/test/fixtures/nuxt5/server/api/alias.ts @@ -1,9 +1,9 @@ -import type { H3Event } from 'nitro/h3' +import type { RequestEvent } from 'nuxt/server' import { asSitemapUrl, defineSitemapEventHandler } from '#sitemap/server' import { getSiteConfig } from '#site-config/server' -// A site utility typed against the Nitro 3 event, as a source handler may call. -function requestPath(event: H3Event) { +// A site utility uses Nuxt's portable request event. +function requestPath(event: RequestEvent) { return event.url.pathname } diff --git a/test/fixtures/nuxt5/server/api/compat.get.ts b/test/fixtures/nuxt5/server/api/compat.get.ts index 1d5b1715..9ac4d277 100644 --- a/test/fixtures/nuxt5/server/api/compat.get.ts +++ b/test/fixtures/nuxt5/server/api/compat.get.ts @@ -1,8 +1,8 @@ -import type { NitroRouteConfig } from 'nitro/types' +import type { AppRouteRules } from 'nuxt/server' import { defineEventHandler } from 'nuxt/server' const routeRule = { sitemap: false, -} satisfies NitroRouteConfig +} satisfies AppRouteRules export default defineEventHandler(() => routeRule) diff --git a/test/fixtures/nuxt5/server/api/route-rules.get.ts b/test/fixtures/nuxt5/server/api/route-rules.get.ts index 36488c0b..afa13530 100644 --- a/test/fixtures/nuxt5/server/api/route-rules.get.ts +++ b/test/fixtures/nuxt5/server/api/route-rules.get.ts @@ -1,17 +1,15 @@ -import type { NitroRouteConfig, NitroRouteRules } from 'nitro/types' -import { getRouteRules } from 'nitro/app' -import { defineEventHandler } from 'nuxt/server' +import type { SitemapItemDefaults } from '@nuxtjs/sitemap' +import type { AppRouteRules } from 'nuxt/server' +import { defineEventHandler, getRouteRules } from 'nuxt/server' const routeConfig = { sitemap: { priority: 0.3, changefreq: 'yearly' }, -} satisfies NitroRouteConfig +} satisfies AppRouteRules export default defineEventHandler((event) => { - const routeRules = { - sitemap: getRouteRules(event.req.method, event.url.pathname).routeRules.sitemap, - } satisfies NitroRouteRules + const sitemap: SitemapItemDefaults | false | undefined = getRouteRules(event).sitemap return { config: routeConfig.sitemap, - resolved: routeRules.sitemap, + resolved: sitemap, } })