site: upgrade Astro 5 → 7
- astro 7.0.7, @astrojs/mdx 7, sitemap 3.7, rss 4.0.19, check 0.9.9 - trailingSlash 'always' → 'ignore': Astro 7 generates prerender paths for dynamic extension endpoints (/categories/<c>/rss.xml) with a trailing slash under 'always' but builds their route patterns without one, so the build fails with "Missing parameter"; directory-format output is identical either way. Also removes the now-unneeded dev feed-slash shim. - compressHTML: true pinned to keep pre-v7 whitespace behavior - zod 4: import z from 'astro/zod' (astro:content re-export deprecated), z.string().url() → z.url() - npm audit fix (fast-uri, fast-xml-builder, yaml) Claude-Session: https://claude.ai/code/session_01WZaczDJjL3xZ3u5spsN5AL
This commit is contained in:
+11
-17
@@ -128,26 +128,20 @@ const setPickApi = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
// With trailingSlash 'always', the dev server only matches dynamic-route
|
|
||||||
// endpoints (/tags/<t>/rss.xml, /categories/<c>/rss.xml) when the request
|
|
||||||
// has a trailing slash; the built site serves them as plain files without
|
|
||||||
// one. Rewrite in dev so the same URLs work in both.
|
|
||||||
const feedSlashShim = {
|
|
||||||
name: 'feed-trailing-slash-dev-shim',
|
|
||||||
apply: 'serve',
|
|
||||||
configureServer(server) {
|
|
||||||
server.middlewares.use((req, _res, next) => {
|
|
||||||
if (/^\/(tags|categories|topics)\/[^/]+\/rss\.xml$/.test(req.url)) req.url += '/';
|
|
||||||
next();
|
|
||||||
});
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
site: 'https://unique.rzen.dev',
|
site: 'https://unique.rzen.dev',
|
||||||
trailingSlash: 'always',
|
// 'ignore', not 'always': Astro 7 generates prerender paths for dynamic
|
||||||
|
// extension endpoints (/categories/<c>/rss.xml) with a trailing slash under
|
||||||
|
// 'always' but builds their route patterns without one, so the build dies
|
||||||
|
// with "Missing parameter". Directory-format output is identical either
|
||||||
|
// way, and 'ignore' also lets the dev server match those endpoints without
|
||||||
|
// the old feed-trailing-slash shim.
|
||||||
|
trailingSlash: 'ignore',
|
||||||
|
// Keep the pre-v7 whitespace behavior; the v7 default 'jsx' collapses
|
||||||
|
// whitespace between adjacent inline elements.
|
||||||
|
compressHTML: true,
|
||||||
build: { format: 'directory' },
|
build: { format: 'directory' },
|
||||||
vite: { plugins: [editFindTagApi, setPickApi, feedSlashShim] },
|
vite: { plugins: [editFindTagApi, setPickApi] },
|
||||||
integrations: [
|
integrations: [
|
||||||
mdx(),
|
mdx(),
|
||||||
sitemap({
|
sitemap({
|
||||||
|
|||||||
Generated
+1544
-1655
File diff suppressed because it is too large
Load Diff
+5
-5
@@ -15,11 +15,11 @@
|
|||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/check": "^0.9.4",
|
"@astrojs/check": "^0.9.9",
|
||||||
"@astrojs/mdx": "^4.3.14",
|
"@astrojs/mdx": "^7.0.2",
|
||||||
"@astrojs/rss": "^4.0.12",
|
"@astrojs/rss": "^4.0.19",
|
||||||
"@astrojs/sitemap": "^3.6.0",
|
"@astrojs/sitemap": "^3.7.3",
|
||||||
"astro": "^5.1.1",
|
"astro": "^7.0.7",
|
||||||
"sharp": "^0.34.0",
|
"sharp": "^0.34.0",
|
||||||
"typescript": "^5.7.2"
|
"typescript": "^5.7.2"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { defineCollection, z } from 'astro:content';
|
import { defineCollection } from 'astro:content';
|
||||||
|
import { z } from 'astro/zod';
|
||||||
import { glob } from 'astro/loaders';
|
import { glob } from 'astro/loaders';
|
||||||
import { TOPICS } from './lib/topics';
|
import { TOPICS } from './lib/topics';
|
||||||
|
|
||||||
@@ -21,9 +22,9 @@ const reviews = defineCollection({
|
|||||||
category: z.string(),
|
category: z.string(),
|
||||||
topics: z.array(z.enum(TOPICS)).default([]),
|
topics: z.array(z.enum(TOPICS)).default([]),
|
||||||
tags: z.array(z.string()).default([]),
|
tags: z.array(z.string()).default([]),
|
||||||
link: z.string().url().optional(),
|
link: z.url().optional(),
|
||||||
linkText: z.string().optional(),
|
linkText: z.string().optional(),
|
||||||
amazonLink: z.string().url().optional(),
|
amazonLink: z.url().optional(),
|
||||||
description: z.string().optional(),
|
description: z.string().optional(),
|
||||||
source: z.string().optional(),
|
source: z.string().optional(),
|
||||||
fromFind: z.string().optional(),
|
fromFind: z.string().optional(),
|
||||||
@@ -55,9 +56,9 @@ const find = defineCollection({
|
|||||||
name: z.string(),
|
name: z.string(),
|
||||||
subtitle: z.string().optional(),
|
subtitle: z.string().optional(),
|
||||||
date: z.coerce.date(),
|
date: z.coerce.date(),
|
||||||
link: z.string().url(),
|
link: z.url(),
|
||||||
linkText: z.string().optional(),
|
linkText: z.string().optional(),
|
||||||
amazonLink: z.string().url().optional(),
|
amazonLink: z.url().optional(),
|
||||||
source: z.string(),
|
source: z.string(),
|
||||||
topics: z.array(z.enum(TOPICS)).default([]),
|
topics: z.array(z.enum(TOPICS)).default([]),
|
||||||
tags: z.array(z.string()).default([]),
|
tags: z.array(z.string()).default([]),
|
||||||
|
|||||||
Reference in New Issue
Block a user