From 51965644283678538a59bd634accc769509192fc Mon Sep 17 00:00:00 2001 From: lsy Date: Sun, 18 May 2025 22:24:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E4=BA=86=E6=B2=A1=E7=94=A8?= =?UTF-8?q?=E7=9A=84=E5=BA=93=EF=BC=8C=E6=9B=B4=E6=96=B0sitemap=EF=BC=8C?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=B1=86=E7=93=A3=E6=9C=8D=E5=8A=A1=E7=AB=AF?= =?UTF-8?q?=E5=87=BD=E6=95=B0,=E4=BC=98=E5=8C=96const=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- astro.config.mjs | 64 +--- package-lock.json | 411 +++++++---------------- package.json | 7 - src/components/Footer.astro | 2 +- src/consts.ts | 16 - src/content/echoes博客使用说明.md | 11 +- src/pages/api/douban.ts | 38 +-- src/pages/books.astro | 3 +- src/pages/movies.astro | 3 +- src/pages/other.astro | 66 ++-- src/plugins/sitemap-integration.js | 515 +++++++++++++++++++++++++++++ 11 files changed, 693 insertions(+), 443 deletions(-) create mode 100644 src/plugins/sitemap-integration.js diff --git a/astro.config.mjs b/astro.config.mjs index 42b14c6..74ff31f 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -5,36 +5,13 @@ import tailwindcss from "@tailwindcss/vite"; import mdx from "@astrojs/mdx"; import react from "@astrojs/react"; import rehypeExternalLinks from "rehype-external-links"; -import sitemap from "@astrojs/sitemap"; -import fs from "node:fs"; -import path from "node:path"; import { SITE_URL } from "./src/consts"; import compressor from "astro-compressor"; import vercel from "@astrojs/vercel"; import { articleIndexerIntegration } from "./src/plugins/build-article-index.js"; import { rehypeCodeBlocks } from "./src/plugins/rehype-code-blocks.js"; import { rehypeTables } from "./src/plugins/rehype-tables.js"; - -function getArticleDate(articleId) { - try { - // 处理多级目录的文章路径 - const mdPath = path.join(process.cwd(), "src/content", articleId + ".md"); - const mdxPath = path.join(process.cwd(), "src/content", articleId + ".mdx"); - - let filePath = fs.existsSync(mdPath) ? mdPath : mdxPath; - - if (fs.existsSync(filePath)) { - const content = fs.readFileSync(filePath, "utf-8"); - const match = content.match(/date:\s*(\d{4}-\d{2}-\d{2})/); - if (match) { - return new Date(match[1]).toISOString(); - } - } - } catch (error) { - console.error("Error reading article date:", error); - } - return new Date().toISOString(); // 如果没有日期,返回当前时间 -} +import { customSitemapIntegration } from "./src/plugins/sitemap-integration.js"; // https://astro.build/config export default defineConfig({ @@ -56,44 +33,7 @@ export default defineConfig({ react(), // 使用文章索引生成器 articleIndexerIntegration(), - sitemap({ - filter: (page) => !page.includes("/api/"), - serialize(item) { - if (!item) return undefined; - - // 文章页面 - if (item.url.includes("/articles/")) { - // 从 URL 中提取文章 ID - const articleId = item.url - .replace(SITE_URL + "/articles/", "") - .replace(/\/$/, ""); - const publishDate = getArticleDate(articleId); - return { - ...item, - priority: 0.8, - lastmod: publishDate, - }; - } - // 其他页面 - else { - let priority = 0.7; // 默认优先级 - - // 首页最高优先级 - if (item.url === SITE_URL + "/") { - priority = 1.0; - } - // 文章列表页次高优先级 - else if (item.url === SITE_URL + "/articles/") { - priority = 0.9; - } - - return { - ...item, - priority, - }; - } - }, - }), + customSitemapIntegration(), // 添加压缩插件 (必须放在最后位置) compressor() ], diff --git a/package-lock.json b/package-lock.json index 8606ac7..3908165 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,11 +11,8 @@ "@astrojs/mdx": "^4.2.5", "@astrojs/node": "^9.2.1", "@astrojs/react": "^4.2.5", - "@astrojs/sitemap": "^3.3.1", "@astrojs/vercel": "^8.1.4", "@astrolib/seo": "^1.0.0-beta.8", - "@expressive-code/plugin-collapsible-sections": "^0.41.2", - "@expressive-code/plugin-line-numbers": "^0.41.2", "@mermaid-js/mermaid-cli": "^11.4.2", "@swup/fragment-plugin": "^1.1.1", "@swup/head-plugin": "^2.3.1", @@ -24,17 +21,13 @@ "@swup/scripts-plugin": "^2.1.0", "@tailwindcss/vite": "^4.1.4", "@types/react": "^19.1.2", - "@types/react-dom": "^19.1.2", "@types/three": "^0.176.0", "astro": "^5.7.5", - "astro-expressive-code": "^0.41.2", "cheerio": "^1.0.0", "mermaid": "^11.6.0", "node-fetch": "^3.3.2", "octokit": "^4.1.3", - "puppeteer": "^23.11.1", "react": "^19.1.0", - "react-dom": "^19.1.0", "react-masonry-css": "^1.0.16", "swup": "^4.8.2", "tailwindcss": "^4.1.4", @@ -216,17 +209,6 @@ "react-dom": "^17.0.2 || ^18.0.0 || ^19.0.0" } }, - "node_modules/@astrojs/sitemap": { - "version": "3.3.1", - "resolved": "https://registry.npmmirror.com/@astrojs/sitemap/-/sitemap-3.3.1.tgz", - "integrity": "sha512-GRnDUCTviBSNfXJ0Jmur+1/C+z3g36jy79VyYggfe1uNyEYSTcmAfTTCmbytrRvJRNyJJnSfB/77Gnm9PiXRRg==", - "license": "MIT", - "dependencies": { - "sitemap": "^8.0.0", - "stream-replace-string": "^2.0.0", - "zod": "^3.24.2" - } - }, "node_modules/@astrojs/telemetry": { "version": "3.2.1", "resolved": "https://registry.npmmirror.com/@astrojs/telemetry/-/telemetry-3.2.1.tgz", @@ -638,15 +620,6 @@ "integrity": "sha512-YslZMgtJUyuMbZ+aKvfF3x1f5liK4mWNxghFRv7jqRR9C3R3fAOGTTKvxXDa2Y1s9zSbcpuO0cAxDYsc9SrXoQ==", "license": "Apache-2.0" }, - "node_modules/@ctrl/tinycolor": { - "version": "4.1.0", - "resolved": "https://registry.npmmirror.com/@ctrl/tinycolor/-/tinycolor-4.1.0.tgz", - "integrity": "sha512-WyOx8cJQ+FQus4Mm4uPIZA64gbk3Wxh0so5Lcii0aJifqwoVOlfFtorjLE0Hen4OYyHZMXDWqMmaQemBhgxFRQ==", - "license": "MIT", - "engines": { - "node": ">=14" - } - }, "node_modules/@dimforge/rapier3d-compat": { "version": "0.12.0", "resolved": "https://registry.npmmirror.com/@dimforge/rapier3d-compat/-/rapier3d-compat-0.12.0.tgz", @@ -1063,69 +1036,6 @@ "node": ">=18" } }, - "node_modules/@expressive-code/core": { - "version": "0.41.2", - "resolved": "https://registry.npmmirror.com/@expressive-code/core/-/core-0.41.2.tgz", - "integrity": "sha512-AJW5Tp9czbLqKMzwudL9Rv4js9afXBxkSGLmCNPq1iRgAYcx9NkTPJiSNCesjKRWoVC328AdSu6fqrD22zDgDg==", - "license": "MIT", - "dependencies": { - "@ctrl/tinycolor": "^4.0.4", - "hast-util-select": "^6.0.2", - "hast-util-to-html": "^9.0.1", - "hast-util-to-text": "^4.0.1", - "hastscript": "^9.0.0", - "postcss": "^8.4.38", - "postcss-nested": "^6.0.1", - "unist-util-visit": "^5.0.0", - "unist-util-visit-parents": "^6.0.1" - } - }, - "node_modules/@expressive-code/plugin-collapsible-sections": { - "version": "0.41.2", - "resolved": "https://registry.npmmirror.com/@expressive-code/plugin-collapsible-sections/-/plugin-collapsible-sections-0.41.2.tgz", - "integrity": "sha512-gyg864xlkLFYLDlOoO5wyZVmuFOc2vi6b/tJjEfXDj/xc8//ttuRLZ0EjuLIkch1hEhEQc9XF6agmiNYUCzeww==", - "license": "MIT", - "dependencies": { - "@expressive-code/core": "^0.41.2" - } - }, - "node_modules/@expressive-code/plugin-frames": { - "version": "0.41.2", - "resolved": "https://registry.npmmirror.com/@expressive-code/plugin-frames/-/plugin-frames-0.41.2.tgz", - "integrity": "sha512-pfy0hkJI4nbaONjmksFDcuHmIuyPTFmi1JpABe4q2ajskiJtfBf+WDAL2pg595R9JNoPrrH5+aT9lbkx2noicw==", - "license": "MIT", - "dependencies": { - "@expressive-code/core": "^0.41.2" - } - }, - "node_modules/@expressive-code/plugin-line-numbers": { - "version": "0.41.2", - "resolved": "https://registry.npmmirror.com/@expressive-code/plugin-line-numbers/-/plugin-line-numbers-0.41.2.tgz", - "integrity": "sha512-xdRoScuFWQbYEpWTh6G7kJ0VK46kcUPHPMjRo3CG2ynZ1rqiJCC9FnZQQWQ7U8aGd/n7EnU3vJBkBeVqhZyEWg==", - "license": "MIT", - "dependencies": { - "@expressive-code/core": "^0.41.2" - } - }, - "node_modules/@expressive-code/plugin-shiki": { - "version": "0.41.2", - "resolved": "https://registry.npmmirror.com/@expressive-code/plugin-shiki/-/plugin-shiki-0.41.2.tgz", - "integrity": "sha512-xD4zwqAkDccXqye+235BH5bN038jYiSMLfUrCOmMlzxPDGWdxJDk5z4uUB/aLfivEF2tXyO2zyaarL3Oqht0fQ==", - "license": "MIT", - "dependencies": { - "@expressive-code/core": "^0.41.2", - "shiki": "^3.2.2" - } - }, - "node_modules/@expressive-code/plugin-text-markers": { - "version": "0.41.2", - "resolved": "https://registry.npmmirror.com/@expressive-code/plugin-text-markers/-/plugin-text-markers-0.41.2.tgz", - "integrity": "sha512-JFWBz2qYxxJOJkkWf96LpeolbnOqJY95TvwYc0hXIHf9oSWV0h0SY268w/5N3EtQaD9KktzDE+VIVwb9jdb3nw==", - "license": "MIT", - "dependencies": { - "@expressive-code/core": "^0.41.2" - } - }, "node_modules/@floating-ui/core": { "version": "1.6.9", "resolved": "https://registry.npmmirror.com/@floating-ui/core/-/core-1.6.9.tgz", @@ -2228,9 +2138,9 @@ } }, "node_modules/@octokit/webhooks": { - "version": "13.8.2", - "resolved": "https://registry.npmmirror.com/@octokit/webhooks/-/webhooks-13.8.2.tgz", - "integrity": "sha512-NgKpxIVp9MnEukvTF9s871v11bYTDZwpuyIYkU0ZIEM3d+DBOeiciIJPuCdjFMC1pQgv05MNKtdhbl8+Q+i3GA==", + "version": "13.9.0", + "resolved": "https://registry.npmmirror.com/@octokit/webhooks/-/webhooks-13.9.0.tgz", + "integrity": "sha512-5Kva+/Gi7c+39d0/0MM/v/5RCZuwqm75fUD+t7Es3Iz/adui54GnjfNmJpkkPkXGC+5IWnEvgqwY6gstK/JlUQ==", "license": "MIT", "dependencies": { "@octokit/openapi-webhooks-types": "11.0.0", @@ -2271,6 +2181,7 @@ "resolved": "https://registry.npmmirror.com/@puppeteer/browsers/-/browsers-2.6.1.tgz", "integrity": "sha512-aBSREisdsGH890S2rQqK82qmQYU3uFpSH8wcZWHgHzl3LfzsxAKbLNiAG9mO8v1Y0UICBeClICxPJvyr0rcuxg==", "license": "Apache-2.0", + "peer": true, "dependencies": { "debug": "^4.4.0", "extract-zip": "^2.0.1", @@ -3021,7 +2932,8 @@ "version": "0.23.0", "resolved": "https://registry.npmmirror.com/@tootallnate/quickjs-emscripten/-/quickjs-emscripten-0.23.0.tgz", "integrity": "sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA==", - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/@tweenjs/tween.js": { "version": "23.1.3", @@ -3409,6 +3321,8 @@ "resolved": "https://registry.npmmirror.com/@types/node/-/node-22.15.3.tgz", "integrity": "sha512-lX7HFZeHf4QG/J7tBZqrCAXwz9J5RD56Y6MpP0eJkka8p+K0RY/yBTW7CYFJ4VGCclxqOLKmiGP5juQc6MKgcw==", "license": "MIT", + "optional": true, + "peer": true, "dependencies": { "undici-types": "~6.21.0" } @@ -3436,19 +3350,11 @@ "resolved": "https://registry.npmmirror.com/@types/react-dom/-/react-dom-19.1.3.tgz", "integrity": "sha512-rJXC08OG0h3W6wDMFxQrZF00Kq6qQvw0djHRdzl3U5DnIERz0MRce3WVc7IS6JYBwtaP/DwYtRRjVlvivNveKg==", "license": "MIT", + "peer": true, "peerDependencies": { "@types/react": "^19.0.0" } }, - "node_modules/@types/sax": { - "version": "1.2.7", - "resolved": "https://registry.npmmirror.com/@types/sax/-/sax-1.2.7.tgz", - "integrity": "sha512-rO73L89PJxeYM3s3pPPjiPgVVcymqU490g0YO5n5By0k2Erzj6tay/4lr1CHAAU4JyOWd1rpQ8bCf6cZfHU96A==", - "license": "MIT", - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/stats.js": { "version": "0.17.3", "resolved": "https://registry.npmmirror.com/@types/stats.js/-/stats.js-0.17.3.tgz", @@ -3495,6 +3401,7 @@ "integrity": "sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==", "license": "MIT", "optional": true, + "peer": true, "dependencies": { "@types/node": "*" } @@ -4153,6 +4060,7 @@ "resolved": "https://registry.npmmirror.com/ast-types/-/ast-types-0.13.4.tgz", "integrity": "sha512-x1FCFnFifvYDDzTaLII71vG5uvDwgtmDTEVWAxrgeiR8VjMONcCXJx7E+USjDtHlwFmt9MysbqgF9b9Vjr6w+w==", "license": "MIT", + "peer": true, "dependencies": { "tslib": "^2.0.1" }, @@ -4258,18 +4166,6 @@ "dev": true, "license": "MIT" }, - "node_modules/astro-expressive-code": { - "version": "0.41.2", - "resolved": "https://registry.npmmirror.com/astro-expressive-code/-/astro-expressive-code-0.41.2.tgz", - "integrity": "sha512-HN0jWTnhr7mIV/2e6uu4PPRNNo/k4UEgTLZqbp3MrHU+caCARveG2yZxaZVBmxyiVdYqW5Pd3u3n2zjnshixbw==", - "license": "MIT", - "dependencies": { - "rehype-expressive-code": "^0.41.2" - }, - "peerDependencies": { - "astro": "^4.0.0-beta || ^5.0.0-beta || ^3.3.0" - } - }, "node_modules/async-sema": { "version": "3.1.1", "resolved": "https://registry.npmmirror.com/async-sema/-/async-sema-3.1.1.tgz", @@ -4298,7 +4194,8 @@ "version": "1.6.7", "resolved": "https://registry.npmmirror.com/b4a/-/b4a-1.6.7.tgz", "integrity": "sha512-OnAYlL5b7LEkALw87fUVafQw5rVR9RjwGd4KUwNQ6DrrNmaVaUCgLipfVlzrPQ4tWOR9P0IXGNOx50jYCCdSJg==", - "license": "Apache-2.0" + "license": "Apache-2.0", + "peer": true }, "node_modules/bail": { "version": "2.0.2", @@ -4321,7 +4218,8 @@ "resolved": "https://registry.npmmirror.com/bare-events/-/bare-events-2.5.4.tgz", "integrity": "sha512-+gFfDkR8pj4/TrWCGUGWmJIkBwuxPS5F+a5yWjOHQt2hHvNZd5YLzadjmDUtFmMM4y429bnKLa8bYBMHcYdnQA==", "license": "Apache-2.0", - "optional": true + "optional": true, + "peer": true }, "node_modules/bare-fs": { "version": "4.1.3", @@ -4329,6 +4227,7 @@ "integrity": "sha512-OeEZYIg+2qepaWLyphaOXHAHKo3xkM8y3BeGAvHdMN8GNWvEAU1Yw6rYpGzu/wDDbKxgEjVeVDpgGhDzaeMpjg==", "license": "Apache-2.0", "optional": true, + "peer": true, "dependencies": { "bare-events": "^2.5.4", "bare-path": "^3.0.0", @@ -4352,6 +4251,7 @@ "integrity": "sha512-uaIjxokhFidJP+bmmvKSgiMzj2sV5GPHaZVAIktcxcpCyBFFWO+YlikVAdhmUo2vYFvFhOXIAlldqV29L8126g==", "license": "Apache-2.0", "optional": true, + "peer": true, "engines": { "bare": ">=1.14.0" } @@ -4362,6 +4262,7 @@ "integrity": "sha512-tyfW2cQcB5NN8Saijrhqn0Zh7AnFNsnczRcuWODH0eYAXBsJ5gVxAUuNr7tsHSC6IZ77cA0SitzT+s47kot8Mw==", "license": "Apache-2.0", "optional": true, + "peer": true, "dependencies": { "bare-os": "^3.0.1" } @@ -4372,6 +4273,7 @@ "integrity": "sha512-jSmxKJNJmHySi6hC42zlZnq00rga4jjxcgNZjY9N5WlOe/iOoGRtdwGsHzQv2RlH2KOYMwGUXhf2zXd32BA9RA==", "license": "Apache-2.0", "optional": true, + "peer": true, "dependencies": { "streamx": "^2.21.0" }, @@ -4419,20 +4321,11 @@ "resolved": "https://registry.npmmirror.com/basic-ftp/-/basic-ftp-5.0.5.tgz", "integrity": "sha512-4Bcg1P8xhUuqcii/S0Z9wiHIrQVPMermM1any+MX5GeGD7faD3/msQUDGLol9wOcz4/jbg/WJnGqoJF6LiBdtg==", "license": "MIT", + "peer": true, "engines": { "node": ">=10.0.0" } }, - "node_modules/bcp-47-match": { - "version": "2.0.3", - "resolved": "https://registry.npmmirror.com/bcp-47-match/-/bcp-47-match-2.0.3.tgz", - "integrity": "sha512-JtTezzbAibu8G0R9op9zb3vcWZd9JF6M0xOYGPn0fNCd7wOpRB1mU2mH9T8gaBGbAAyIIVgB2G7xG0GP98zMAQ==", - "license": "MIT", - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, "node_modules/before-after-hook": { "version": "3.0.2", "resolved": "https://registry.npmmirror.com/before-after-hook/-/before-after-hook-3.0.2.tgz", @@ -4605,6 +4498,7 @@ "resolved": "https://registry.npmmirror.com/buffer-crc32/-/buffer-crc32-0.2.13.tgz", "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==", "license": "MIT", + "peer": true, "engines": { "node": "*" } @@ -4622,6 +4516,7 @@ "resolved": "https://registry.npmmirror.com/callsites/-/callsites-3.1.0.tgz", "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", "license": "MIT", + "peer": true, "engines": { "node": ">=6" } @@ -4826,6 +4721,7 @@ "resolved": "https://registry.npmmirror.com/chromium-bidi/-/chromium-bidi-0.11.0.tgz", "integrity": "sha512-6CJWHkNRoyZyjV9Rwv2lYONZf1Xm0IuDyNq97nwSsxxP3wf5Bwy15K5rOvVKMtJ127jJBmxFUanSAOjgFRxgrA==", "license": "Apache-2.0", + "peer": true, "dependencies": { "mitt": "3.0.1", "zod": "3.23.8" @@ -4839,6 +4735,7 @@ "resolved": "https://registry.npmmirror.com/zod/-/zod-3.23.8.tgz", "integrity": "sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==", "license": "MIT", + "peer": true, "funding": { "url": "https://github.com/sponsors/colinhacks" } @@ -4875,6 +4772,7 @@ "resolved": "https://registry.npmmirror.com/cliui/-/cliui-8.0.1.tgz", "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", "license": "ISC", + "peer": true, "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.1", @@ -4889,6 +4787,7 @@ "resolved": "https://registry.npmmirror.com/ansi-regex/-/ansi-regex-5.0.1.tgz", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "license": "MIT", + "peer": true, "engines": { "node": ">=8" } @@ -4898,6 +4797,7 @@ "resolved": "https://registry.npmmirror.com/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "license": "MIT", + "peer": true, "dependencies": { "color-convert": "^2.0.1" }, @@ -4912,13 +4812,15 @@ "version": "8.0.0", "resolved": "https://registry.npmmirror.com/emoji-regex/-/emoji-regex-8.0.0.tgz", "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/cliui/node_modules/string-width": { "version": "4.2.3", "resolved": "https://registry.npmmirror.com/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "license": "MIT", + "peer": true, "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -4933,6 +4835,7 @@ "resolved": "https://registry.npmmirror.com/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "license": "MIT", + "peer": true, "dependencies": { "ansi-regex": "^5.0.1" }, @@ -4945,6 +4848,7 @@ "resolved": "https://registry.npmmirror.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", "license": "MIT", + "peer": true, "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", @@ -5102,6 +5006,7 @@ "resolved": "https://registry.npmmirror.com/cosmiconfig/-/cosmiconfig-9.0.0.tgz", "integrity": "sha512-itvL5h8RETACmOTFc4UfIyB2RfEHi71Ax6E/PivVxq9NseKbOWpeyHEOIbmAw1rs8Ak0VursQNww7lf7YtUwzg==", "license": "MIT", + "peer": true, "dependencies": { "env-paths": "^2.2.1", "import-fresh": "^3.3.0", @@ -5191,22 +5096,6 @@ "url": "https://github.com/sponsors/fb55" } }, - "node_modules/css-selector-parser": { - "version": "3.1.2", - "resolved": "https://registry.npmmirror.com/css-selector-parser/-/css-selector-parser-3.1.2.tgz", - "integrity": "sha512-WfUcL99xWDs7b3eZPoRszWVfbNo8ErCF15PTvVROjkShGlAfjIkG6hlfj/sl6/rfo5Q9x9ryJ3VqVnAZDA+gcw==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/mdevils" - }, - { - "type": "patreon", - "url": "https://patreon.com/mdevils" - } - ], - "license": "MIT" - }, "node_modules/css-tree": { "version": "3.1.0", "resolved": "https://registry.npmmirror.com/css-tree/-/css-tree-3.1.0.tgz", @@ -5815,6 +5704,7 @@ "resolved": "https://registry.npmmirror.com/degenerator/-/degenerator-5.0.1.tgz", "integrity": "sha512-TllpMR/t0M5sqCXfj85i4XaAzxmS5tVA16dqvdkMwGmzI+dXLXnw3J+3Vdv7VKw+ThlTMboK6i9rnZ6Nntj5CQ==", "license": "MIT", + "peer": true, "dependencies": { "ast-types": "^0.13.4", "escodegen": "^2.1.0", @@ -5913,7 +5803,8 @@ "version": "0.0.1367902", "resolved": "https://registry.npmmirror.com/devtools-protocol/-/devtools-protocol-0.0.1367902.tgz", "integrity": "sha512-XxtPuC3PGakY6PD7dG66/o8KwJ/LkH2/EKe19Dcw58w53dv4/vSQEkn/SzuyhHE2q4zPgCkxQBxus3VV4ql+Pg==", - "license": "BSD-3-Clause" + "license": "BSD-3-Clause", + "peer": true }, "node_modules/dfa": { "version": "1.2.0", @@ -5936,19 +5827,6 @@ "node": ">=0.3.1" } }, - "node_modules/direction": { - "version": "2.0.1", - "resolved": "https://registry.npmmirror.com/direction/-/direction-2.0.1.tgz", - "integrity": "sha512-9S6m9Sukh1cZNknO1CWAr2QAWsbKLafQiyM5gZ7VgXHeuaoUwffKN4q6NC4A/Mf9iiPlOXQEKW/Mv/mh9/3YFA==", - "license": "MIT", - "bin": { - "direction": "cli.js" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/wooorm" - } - }, "node_modules/dlv": { "version": "1.1.3", "resolved": "https://registry.npmmirror.com/dlv/-/dlv-1.1.3.tgz", @@ -6085,6 +5963,7 @@ "resolved": "https://registry.npmmirror.com/end-of-stream/-/end-of-stream-1.4.4.tgz", "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", "license": "MIT", + "peer": true, "dependencies": { "once": "^1.4.0" } @@ -6119,6 +5998,7 @@ "resolved": "https://registry.npmmirror.com/env-paths/-/env-paths-2.2.1.tgz", "integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==", "license": "MIT", + "peer": true, "engines": { "node": ">=6" } @@ -6128,6 +6008,7 @@ "resolved": "https://registry.npmmirror.com/error-ex/-/error-ex-1.3.2.tgz", "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", "license": "MIT", + "peer": true, "dependencies": { "is-arrayish": "^0.2.1" } @@ -6242,6 +6123,7 @@ "resolved": "https://registry.npmmirror.com/escodegen/-/escodegen-2.1.0.tgz", "integrity": "sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w==", "license": "BSD-2-Clause", + "peer": true, "dependencies": { "esprima": "^4.0.1", "estraverse": "^5.2.0", @@ -6264,6 +6146,7 @@ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "license": "BSD-3-Clause", "optional": true, + "peer": true, "engines": { "node": ">=0.10.0" } @@ -6273,6 +6156,7 @@ "resolved": "https://registry.npmmirror.com/esprima/-/esprima-4.0.1.tgz", "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", "license": "BSD-2-Clause", + "peer": true, "bin": { "esparse": "bin/esparse.js", "esvalidate": "bin/esvalidate.js" @@ -6286,6 +6170,7 @@ "resolved": "https://registry.npmmirror.com/estraverse/-/estraverse-5.3.0.tgz", "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "license": "BSD-2-Clause", + "peer": true, "engines": { "node": ">=4.0" } @@ -6386,6 +6271,7 @@ "resolved": "https://registry.npmmirror.com/esutils/-/esutils-2.0.3.tgz", "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "license": "BSD-2-Clause", + "peer": true, "engines": { "node": ">=0.10.0" } @@ -6423,18 +6309,6 @@ "node": ">=0.8.x" } }, - "node_modules/expressive-code": { - "version": "0.41.2", - "resolved": "https://registry.npmmirror.com/expressive-code/-/expressive-code-0.41.2.tgz", - "integrity": "sha512-aLZiZaqorRtNExtGpUjK9zFH9aTpWeoTXMyLo4b4IcuXfPqtLPPxhRm/QlPb8QqIcMMXnSiGRHSFpQfX0m7HJw==", - "license": "MIT", - "dependencies": { - "@expressive-code/core": "^0.41.2", - "@expressive-code/plugin-frames": "^0.41.2", - "@expressive-code/plugin-shiki": "^0.41.2", - "@expressive-code/plugin-text-markers": "^0.41.2" - } - }, "node_modules/exsolve": { "version": "1.0.5", "resolved": "https://registry.npmmirror.com/exsolve/-/exsolve-1.0.5.tgz", @@ -6452,6 +6326,7 @@ "resolved": "https://registry.npmmirror.com/extract-zip/-/extract-zip-2.0.1.tgz", "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==", "license": "BSD-2-Clause", + "peer": true, "dependencies": { "debug": "^4.1.1", "get-stream": "^5.1.0", @@ -6493,7 +6368,8 @@ "version": "1.3.2", "resolved": "https://registry.npmmirror.com/fast-fifo/-/fast-fifo-1.3.2.tgz", "integrity": "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==", - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/fast-glob": { "version": "3.3.3", @@ -6553,6 +6429,7 @@ "resolved": "https://registry.npmmirror.com/fd-slicer/-/fd-slicer-1.1.0.tgz", "integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==", "license": "MIT", + "peer": true, "dependencies": { "pend": "~1.2.0" } @@ -6724,6 +6601,7 @@ "resolved": "https://registry.npmmirror.com/get-caller-file/-/get-caller-file-2.0.5.tgz", "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", "license": "ISC", + "peer": true, "engines": { "node": "6.* || 8.* || >= 10.*" } @@ -6745,6 +6623,7 @@ "resolved": "https://registry.npmmirror.com/get-stream/-/get-stream-5.2.0.tgz", "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", "license": "MIT", + "peer": true, "dependencies": { "pump": "^3.0.0" }, @@ -6760,6 +6639,7 @@ "resolved": "https://registry.npmmirror.com/get-uri/-/get-uri-6.0.4.tgz", "integrity": "sha512-E1b1lFFLvLgak2whF2xDBcOy6NLVGZBqqjJjsIhvopKfWWEi64pLVTWWehV8KlLerZkfNTA95sTe2OdJKm1OzQ==", "license": "MIT", + "peer": true, "dependencies": { "basic-ftp": "^5.0.2", "data-uri-to-buffer": "^6.0.2", @@ -6774,6 +6654,7 @@ "resolved": "https://registry.npmmirror.com/data-uri-to-buffer/-/data-uri-to-buffer-6.0.2.tgz", "integrity": "sha512-7hvf7/GW8e86rW0ptuwS3OcBGDjIi6SZva7hCyWC0yYry2cOPmLIjXAUHI6DK2HsnwJd9ifmt57i8eV2n4YNpw==", "license": "MIT", + "peer": true, "engines": { "node": ">= 14" } @@ -6904,19 +6785,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/hast-util-has-property": { - "version": "3.0.0", - "resolved": "https://registry.npmmirror.com/hast-util-has-property/-/hast-util-has-property-3.0.0.tgz", - "integrity": "sha512-MNilsvEKLFpV604hwfhVStK0usFY/QmM5zX16bo7EjnAEGofr5YyI37kzopBlZJkHD4t887i+q/C8/tr5Q94cA==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/hast-util-is-element": { "version": "3.0.0", "resolved": "https://registry.npmmirror.com/hast-util-is-element/-/hast-util-is-element-3.0.0.tgz", @@ -6968,33 +6836,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/hast-util-select": { - "version": "6.0.4", - "resolved": "https://registry.npmmirror.com/hast-util-select/-/hast-util-select-6.0.4.tgz", - "integrity": "sha512-RqGS1ZgI0MwxLaKLDxjprynNzINEkRHY2i8ln4DDjgv9ZhcYVIHN9rlpiYsqtFwrgpYU361SyWDQcGNIBVu3lw==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.0", - "@types/unist": "^3.0.0", - "bcp-47-match": "^2.0.0", - "comma-separated-tokens": "^2.0.0", - "css-selector-parser": "^3.0.0", - "devlop": "^1.0.0", - "direction": "^2.0.0", - "hast-util-has-property": "^3.0.0", - "hast-util-to-string": "^3.0.0", - "hast-util-whitespace": "^3.0.0", - "nth-check": "^2.0.0", - "property-information": "^7.0.0", - "space-separated-tokens": "^2.0.0", - "unist-util-visit": "^5.0.0", - "zwitch": "^2.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/hast-util-to-estree": { "version": "3.1.3", "resolved": "https://registry.npmmirror.com/hast-util-to-estree/-/hast-util-to-estree-3.1.3.tgz", @@ -7102,19 +6943,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/hast-util-to-string": { - "version": "3.0.1", - "resolved": "https://registry.npmmirror.com/hast-util-to-string/-/hast-util-to-string-3.0.1.tgz", - "integrity": "sha512-XelQVTDWvqcl3axRfI0xSeoVKzyIFPwsAGSLIsKdJKQMXDYJS4WYrBNF/8J7RdhIcFI2BOHgAifggsvsxp/3+A==", - "license": "MIT", - "dependencies": { - "@types/hast": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/hast-util-to-text": { "version": "4.0.2", "resolved": "https://registry.npmmirror.com/hast-util-to-text/-/hast-util-to-text-4.0.2.tgz", @@ -7229,6 +7057,7 @@ "resolved": "https://registry.npmmirror.com/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", "license": "MIT", + "peer": true, "dependencies": { "agent-base": "^7.1.0", "debug": "^4.3.4" @@ -7287,6 +7116,7 @@ "resolved": "https://registry.npmmirror.com/import-fresh/-/import-fresh-3.3.1.tgz", "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", "license": "MIT", + "peer": true, "dependencies": { "parent-module": "^1.0.0", "resolve-from": "^4.0.0" @@ -7303,6 +7133,7 @@ "resolved": "https://registry.npmmirror.com/resolve-from/-/resolve-from-4.0.0.tgz", "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", "license": "MIT", + "peer": true, "engines": { "node": ">=4" } @@ -7343,6 +7174,7 @@ "resolved": "https://registry.npmmirror.com/ip-address/-/ip-address-9.0.5.tgz", "integrity": "sha512-zHtQzGojZXTwZTHQqra+ETKd4Sn3vgi7uBmlPoXVWZqYvuKmtI0l/VZTjqGmJY9x88GGOaZ9+G9ES8hC4T4X8g==", "license": "MIT", + "peer": true, "dependencies": { "jsbn": "1.1.0", "sprintf-js": "^1.1.3" @@ -7401,7 +7233,8 @@ "version": "0.2.1", "resolved": "https://registry.npmmirror.com/is-arrayish/-/is-arrayish-0.2.1.tgz", "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/is-binary-path": { "version": "2.1.0", @@ -7601,7 +7434,8 @@ "version": "1.1.0", "resolved": "https://registry.npmmirror.com/jsbn/-/jsbn-1.1.0.tgz", "integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==", - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/jsesc": { "version": "3.1.0", @@ -7619,7 +7453,8 @@ "version": "2.3.1", "resolved": "https://registry.npmmirror.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/json-schema-traverse": { "version": "0.4.1", @@ -9230,7 +9065,8 @@ "version": "3.0.1", "resolved": "https://registry.npmmirror.com/mitt/-/mitt-3.0.1.tgz", "integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==", - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/mkdirp": { "version": "3.0.1", @@ -9334,6 +9170,7 @@ "resolved": "https://registry.npmmirror.com/netmask/-/netmask-2.0.2.tgz", "integrity": "sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg==", "license": "MIT", + "peer": true, "engines": { "node": ">= 0.4.0" } @@ -9536,6 +9373,7 @@ "resolved": "https://registry.npmmirror.com/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", "license": "ISC", + "peer": true, "dependencies": { "wrappy": "1" } @@ -9614,6 +9452,7 @@ "resolved": "https://registry.npmmirror.com/pac-proxy-agent/-/pac-proxy-agent-7.2.0.tgz", "integrity": "sha512-TEB8ESquiLMc0lV8vcd5Ql/JAKAoyzHFXaStwjkzpOpC5Yv+pIzLfHvjTSdf3vpa2bMiUQrg9i6276yn8666aA==", "license": "MIT", + "peer": true, "dependencies": { "@tootallnate/quickjs-emscripten": "^0.23.0", "agent-base": "^7.1.2", @@ -9633,6 +9472,7 @@ "resolved": "https://registry.npmmirror.com/pac-resolver/-/pac-resolver-7.0.1.tgz", "integrity": "sha512-5NPgf87AT2STgwa2ntRMr45jTKrYBGkVU36yT0ig/n/GMAa3oPqhZfIQ2kMEimReg0+t9kZViDVZ83qfVUlckg==", "license": "MIT", + "peer": true, "dependencies": { "degenerator": "^5.0.0", "netmask": "^2.0.2" @@ -9664,6 +9504,7 @@ "resolved": "https://registry.npmmirror.com/parent-module/-/parent-module-1.0.1.tgz", "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", "license": "MIT", + "peer": true, "dependencies": { "callsites": "^3.0.0" }, @@ -9701,6 +9542,7 @@ "resolved": "https://registry.npmmirror.com/parse-json/-/parse-json-5.2.0.tgz", "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", "license": "MIT", + "peer": true, "dependencies": { "@babel/code-frame": "^7.0.0", "error-ex": "^1.3.1", @@ -9847,7 +9689,8 @@ "version": "1.2.0", "resolved": "https://registry.npmmirror.com/pend/-/pend-1.2.0.tgz", "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==", - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/picocolors": { "version": "1.1.1", @@ -10092,6 +9935,7 @@ "resolved": "https://registry.npmmirror.com/progress/-/progress-2.0.3.tgz", "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", "license": "MIT", + "peer": true, "engines": { "node": ">=0.4.0" } @@ -10133,6 +9977,7 @@ "resolved": "https://registry.npmmirror.com/proxy-agent/-/proxy-agent-6.5.0.tgz", "integrity": "sha512-TmatMXdr2KlRiA2CyDu8GqR8EjahTG3aY3nXjdzFyoZbmB8hrBsTyMezhULIXKnC0jpfjlmiZ3+EaCzoInSu/A==", "license": "MIT", + "peer": true, "dependencies": { "agent-base": "^7.1.2", "debug": "^4.3.4", @@ -10152,6 +9997,7 @@ "resolved": "https://registry.npmmirror.com/lru-cache/-/lru-cache-7.18.3.tgz", "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", "license": "ISC", + "peer": true, "engines": { "node": ">=12" } @@ -10160,13 +10006,15 @@ "version": "1.1.0", "resolved": "https://registry.npmmirror.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz", "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/pump": { "version": "3.0.2", "resolved": "https://registry.npmmirror.com/pump/-/pump-3.0.2.tgz", "integrity": "sha512-tUPXtzlGM8FE3P0ZL6DVs/3P58k9nk8/jZeQCurTJylQA8qFYzHFfhBJkuqyE0FifOsQ0uKWekiZ5g8wtr28cw==", "license": "MIT", + "peer": true, "dependencies": { "end-of-stream": "^1.1.0", "once": "^1.3.1" @@ -10188,6 +10036,7 @@ "integrity": "sha512-53uIX3KR5en8l7Vd8n5DUv90Ae9QDQsyIthaUFVzwV6yU750RjqRznEtNMBT20VthqAdemnJN+hxVdmMHKt7Zw==", "hasInstallScript": true, "license": "Apache-2.0", + "peer": true, "dependencies": { "@puppeteer/browsers": "2.6.1", "chromium-bidi": "0.11.0", @@ -10208,6 +10057,7 @@ "resolved": "https://registry.npmmirror.com/puppeteer-core/-/puppeteer-core-23.11.1.tgz", "integrity": "sha512-3HZ2/7hdDKZvZQ7dhhITOUg4/wOrDRjyK2ZBllRB0ZCOi9u0cwq1ACHDjBB+nX+7+kltHjQvBRdeY7+W0T+7Gg==", "license": "Apache-2.0", + "peer": true, "dependencies": { "@puppeteer/browsers": "2.6.1", "chromium-bidi": "0.11.0", @@ -10301,6 +10151,7 @@ "resolved": "https://registry.npmmirror.com/react-dom/-/react-dom-19.1.0.tgz", "integrity": "sha512-Xs1hdnE+DyKgeHJeJznQmYMIBG3TKIHJJT95Q58nHLSrElKlGQqDTR2HQ9fx5CN/Gk6Vh/kupBTDLU11/nDk/g==", "license": "MIT", + "peer": true, "dependencies": { "scheduler": "^0.26.0" }, @@ -10486,15 +10337,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/rehype-expressive-code": { - "version": "0.41.2", - "resolved": "https://registry.npmmirror.com/rehype-expressive-code/-/rehype-expressive-code-0.41.2.tgz", - "integrity": "sha512-vHYfWO9WxAw6kHHctddOt+P4266BtyT1mrOIuxJD+1ELuvuJAa5uBIhYt0OVMyOhlvf57hzWOXJkHnMhpaHyxw==", - "license": "MIT", - "dependencies": { - "expressive-code": "^0.41.2" - } - }, "node_modules/rehype-external-links": { "version": "3.0.0", "resolved": "https://registry.npmmirror.com/rehype-external-links/-/rehype-external-links-3.0.0.tgz", @@ -10674,6 +10516,7 @@ "resolved": "https://registry.npmmirror.com/require-directory/-/require-directory-2.1.1.tgz", "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", "license": "MIT", + "peer": true, "engines": { "node": ">=0.10.0" } @@ -10905,17 +10748,12 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "license": "MIT" }, - "node_modules/sax": { - "version": "1.4.1", - "resolved": "https://registry.npmmirror.com/sax/-/sax-1.4.1.tgz", - "integrity": "sha512-+aWOz7yVScEGoKNd4PA10LZ8sk0A/z5+nXQG5giUO5rprX9jgYsTdov9qCchZiPIZezbZH+jRut8nPodFAX4Jg==", - "license": "ISC" - }, "node_modules/scheduler": { "version": "0.26.0", "resolved": "https://registry.npmmirror.com/scheduler/-/scheduler-0.26.0.tgz", "integrity": "sha512-NlHwttCI/l5gCPR3D1nNXtWABUmBwvZpEQiD4IXSbIDq8BzLIK/7Ir5gTFSGZDUu37K5cMNp0hFtzO38sC7gWA==", - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/semver": { "version": "7.7.1", @@ -11073,36 +10911,12 @@ "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==", "license": "MIT" }, - "node_modules/sitemap": { - "version": "8.0.0", - "resolved": "https://registry.npmmirror.com/sitemap/-/sitemap-8.0.0.tgz", - "integrity": "sha512-+AbdxhM9kJsHtruUF39bwS/B0Fytw6Fr1o4ZAIAEqA6cke2xcoO2GleBw9Zw7nRzILVEgz7zBM5GiTJjie1G9A==", - "license": "MIT", - "dependencies": { - "@types/node": "^17.0.5", - "@types/sax": "^1.2.1", - "arg": "^5.0.0", - "sax": "^1.2.4" - }, - "bin": { - "sitemap": "dist/cli.js" - }, - "engines": { - "node": ">=14.0.0", - "npm": ">=6.0.0" - } - }, - "node_modules/sitemap/node_modules/@types/node": { - "version": "17.0.45", - "resolved": "https://registry.npmmirror.com/@types/node/-/node-17.0.45.tgz", - "integrity": "sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw==", - "license": "MIT" - }, "node_modules/smart-buffer": { "version": "4.2.0", "resolved": "https://registry.npmmirror.com/smart-buffer/-/smart-buffer-4.2.0.tgz", "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", "license": "MIT", + "peer": true, "engines": { "node": ">= 6.0.0", "npm": ">= 3.0.0" @@ -11125,6 +10939,7 @@ "resolved": "https://registry.npmmirror.com/socks/-/socks-2.8.4.tgz", "integrity": "sha512-D3YaD0aRxR3mEcqnidIs7ReYJFVzWdd6fXJYUM8ixcQcJRGTka/b3saV0KflYhyVJXKhb947GndU35SxYNResQ==", "license": "MIT", + "peer": true, "dependencies": { "ip-address": "^9.0.5", "smart-buffer": "^4.2.0" @@ -11139,6 +10954,7 @@ "resolved": "https://registry.npmmirror.com/socks-proxy-agent/-/socks-proxy-agent-8.0.5.tgz", "integrity": "sha512-HehCEsotFqbPW9sJ8WVYB6UbmIMv7kUUORIF2Nncq4VQvBfNBLibW9YZR5dlYCSUhwcD628pRllm7n+E+YTzJw==", "license": "MIT", + "peer": true, "dependencies": { "agent-base": "^7.1.2", "debug": "^4.3.4", @@ -11221,7 +11037,8 @@ "version": "1.1.3", "resolved": "https://registry.npmmirror.com/sprintf-js/-/sprintf-js-1.1.3.tgz", "integrity": "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==", - "license": "BSD-3-Clause" + "license": "BSD-3-Clause", + "peer": true }, "node_modules/statuses": { "version": "2.0.1", @@ -11232,17 +11049,12 @@ "node": ">= 0.8" } }, - "node_modules/stream-replace-string": { - "version": "2.0.0", - "resolved": "https://registry.npmmirror.com/stream-replace-string/-/stream-replace-string-2.0.0.tgz", - "integrity": "sha512-TlnjJ1C0QrmxRNrON00JvaFFlNh5TTG00APw23j74ET7gkQpTASi6/L2fuiav8pzK715HXtUeClpBTw2NPSn6w==", - "license": "MIT" - }, "node_modules/streamx": { "version": "2.22.0", "resolved": "https://registry.npmmirror.com/streamx/-/streamx-2.22.0.tgz", "integrity": "sha512-sLh1evHOzBy/iWRiR6d1zRcLao4gGZr3C1kzNz4fopCOKJb6xD9ub8Mpi9Mr1R6id5o43S+d93fI48UC5uM9aw==", "license": "MIT", + "peer": true, "dependencies": { "fast-fifo": "^1.3.2", "text-decoder": "^1.1.0" @@ -11492,6 +11304,7 @@ "resolved": "https://registry.npmmirror.com/tar-fs/-/tar-fs-3.0.8.tgz", "integrity": "sha512-ZoROL70jptorGAlgAYiLoBLItEKw/fUxg9BSYK/dF/GAGYFJOJJJMvjPAKDJraCXFwadD456FCuvLWgfhMsPwg==", "license": "MIT", + "peer": true, "dependencies": { "pump": "^3.0.0", "tar-stream": "^3.1.5" @@ -11506,6 +11319,7 @@ "resolved": "https://registry.npmmirror.com/tar-stream/-/tar-stream-3.1.7.tgz", "integrity": "sha512-qJj60CXt7IU1Ffyc3NJMjh6EkuCFej46zUqJ4J7pqYlThyd9bO0XBTmcOIhSzZJVWfsLks0+nle/j538YAW9RQ==", "license": "MIT", + "peer": true, "dependencies": { "b4a": "^1.6.4", "fast-fifo": "^1.2.0", @@ -11554,6 +11368,7 @@ "resolved": "https://registry.npmmirror.com/text-decoder/-/text-decoder-1.2.3.tgz", "integrity": "sha512-3/o9z3X0X0fTupwsYvR03pJ/DjWuqqrfwBgTQzdWDiQSm9KitAyz/9WqsT2JQW7KV2m+bC2ol/zqpW37NHxLaA==", "license": "Apache-2.0", + "peer": true, "dependencies": { "b4a": "^1.6.4" } @@ -11598,7 +11413,8 @@ "version": "2.3.8", "resolved": "https://registry.npmmirror.com/through/-/through-2.3.8.tgz", "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/tiny-inflate": { "version": "1.0.3", @@ -11780,6 +11596,7 @@ "resolved": "https://registry.npmmirror.com/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz", "integrity": "sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==", "license": "MIT", + "peer": true, "dependencies": { "buffer": "^5.2.1", "through": "^2.3.8" @@ -11804,6 +11621,7 @@ } ], "license": "MIT", + "peer": true, "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.1.13" @@ -11816,9 +11634,9 @@ "license": "MIT" }, "node_modules/undici": { - "version": "6.21.2", - "resolved": "https://registry.npmmirror.com/undici/-/undici-6.21.2.tgz", - "integrity": "sha512-uROZWze0R0itiAKVPsYhFov9LxrPMHLMEQFszeI2gCN6bnIIZ8twzBCJcN2LJrBBLfrP0t1FW0g+JmKVl8Vk1g==", + "version": "6.21.3", + "resolved": "https://registry.npmmirror.com/undici/-/undici-6.21.3.tgz", + "integrity": "sha512-gBLkYIlEnSp8pFbT64yFgGE6UIB9tAkhukC23PmMDCe5Nd+cRqKxSjw5y54MK2AZMgZfJWMaNE4nYUHgi1XEOw==", "license": "MIT", "engines": { "node": ">=18.17" @@ -11828,7 +11646,9 @@ "version": "6.21.0", "resolved": "https://registry.npmmirror.com/undici-types/-/undici-types-6.21.0.tgz", "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", - "license": "MIT" + "license": "MIT", + "optional": true, + "peer": true }, "node_modules/unicode-properties": { "version": "1.4.1", @@ -12016,15 +11836,15 @@ } }, "node_modules/universal-github-app-jwt": { - "version": "2.2.1", - "resolved": "https://registry.npmmirror.com/universal-github-app-jwt/-/universal-github-app-jwt-2.2.1.tgz", - "integrity": "sha512-O4z+c9zZM4eNZMAx1lanAzaj2bvyJW5kC5PZ/H25D86sd2WujACASCOEZEQXUpZm8H+y7CGhCaB0aPP2kPAtkg==", + "version": "2.2.2", + "resolved": "https://registry.npmmirror.com/universal-github-app-jwt/-/universal-github-app-jwt-2.2.2.tgz", + "integrity": "sha512-dcmbeSrOdTnsjGjUfAlqNDJrhxXizjAz94ija9Qw8YkZ1uu0d+GoZzyH+Jb9tIIqvGsadUfwg+22k5aDqqwzbw==", "license": "MIT" }, "node_modules/universal-user-agent": { - "version": "7.0.2", - "resolved": "https://registry.npmmirror.com/universal-user-agent/-/universal-user-agent-7.0.2.tgz", - "integrity": "sha512-0JCqzSKnStlRRQfCdowvqy3cy0Dvtlb8xecj/H8JFZuCze4rwjPZQOgvFvn0Ws/usCHQFGpyr+pB9adaGwXn4Q==", + "version": "7.0.3", + "resolved": "https://registry.npmmirror.com/universal-user-agent/-/universal-user-agent-7.0.3.tgz", + "integrity": "sha512-TmnEAEAsBJVZM/AADELsK76llnwcf9vMKuPz8JflO1frO8Lchitr0fNaN9d+Ap0BjKtqWqd/J17qeDnXh8CL2A==", "license": "ISC" }, "node_modules/unstorage": { @@ -12590,13 +12410,15 @@ "version": "1.0.2", "resolved": "https://registry.npmmirror.com/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "license": "ISC" + "license": "ISC", + "peer": true }, "node_modules/ws": { "version": "8.18.1", "resolved": "https://registry.npmmirror.com/ws/-/ws-8.18.1.tgz", "integrity": "sha512-RKW2aJZMXeMxVpnZ6bck+RswznaxmzdULiBr6KY7XkTnW8uvt0iT9H5DkHUChXrc+uurzwa0rVI16n/Xzjdz1w==", "license": "MIT", + "peer": true, "engines": { "node": ">=10.0.0" }, @@ -12624,6 +12446,7 @@ "resolved": "https://registry.npmmirror.com/y18n/-/y18n-5.0.8.tgz", "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", "license": "ISC", + "peer": true, "engines": { "node": ">=10" } @@ -12651,6 +12474,7 @@ "resolved": "https://registry.npmmirror.com/yargs/-/yargs-17.7.2.tgz", "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", "license": "MIT", + "peer": true, "dependencies": { "cliui": "^8.0.1", "escalade": "^3.1.1", @@ -12678,6 +12502,7 @@ "resolved": "https://registry.npmmirror.com/ansi-regex/-/ansi-regex-5.0.1.tgz", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "license": "MIT", + "peer": true, "engines": { "node": ">=8" } @@ -12686,13 +12511,15 @@ "version": "8.0.0", "resolved": "https://registry.npmmirror.com/emoji-regex/-/emoji-regex-8.0.0.tgz", "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/yargs/node_modules/string-width": { "version": "4.2.3", "resolved": "https://registry.npmmirror.com/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "license": "MIT", + "peer": true, "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -12707,6 +12534,7 @@ "resolved": "https://registry.npmmirror.com/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "license": "MIT", + "peer": true, "dependencies": { "ansi-regex": "^5.0.1" }, @@ -12719,6 +12547,7 @@ "resolved": "https://registry.npmmirror.com/yauzl/-/yauzl-2.10.0.tgz", "integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==", "license": "MIT", + "peer": true, "dependencies": { "buffer-crc32": "~0.2.3", "fd-slicer": "~1.1.0" diff --git a/package.json b/package.json index 474b0c2..ebc82be 100644 --- a/package.json +++ b/package.json @@ -12,11 +12,8 @@ "@astrojs/mdx": "^4.2.5", "@astrojs/node": "^9.2.1", "@astrojs/react": "^4.2.5", - "@astrojs/sitemap": "^3.3.1", "@astrojs/vercel": "^8.1.4", "@astrolib/seo": "^1.0.0-beta.8", - "@expressive-code/plugin-collapsible-sections": "^0.41.2", - "@expressive-code/plugin-line-numbers": "^0.41.2", "@mermaid-js/mermaid-cli": "^11.4.2", "@swup/fragment-plugin": "^1.1.1", "@swup/head-plugin": "^2.3.1", @@ -25,17 +22,13 @@ "@swup/scripts-plugin": "^2.1.0", "@tailwindcss/vite": "^4.1.4", "@types/react": "^19.1.2", - "@types/react-dom": "^19.1.2", "@types/three": "^0.176.0", "astro": "^5.7.5", - "astro-expressive-code": "^0.41.2", "cheerio": "^1.0.0", "mermaid": "^11.6.0", "node-fetch": "^3.3.2", "octokit": "^4.1.3", - "puppeteer": "^23.11.1", "react": "^19.1.0", - "react-dom": "^19.1.0", "react-masonry-css": "^1.0.16", "swup": "^4.8.2", "tailwindcss": "^4.1.4", diff --git a/src/components/Footer.astro b/src/components/Footer.astro index 17b0554..4b2827f 100644 --- a/src/components/Footer.astro +++ b/src/components/Footer.astro @@ -75,7 +75,7 @@ const currentYear = new Date().getFullYear(); >· // 展示读书记录 ``` diff --git a/src/pages/api/douban.ts b/src/pages/api/douban.ts index 70dcee4..45d6b76 100644 --- a/src/pages/api/douban.ts +++ b/src/pages/api/douban.ts @@ -9,16 +9,6 @@ const MAX_RETRIES = 0; // 最大重试次数 const RETRY_DELAY = 1500; // 重试延迟(毫秒) const REQUEST_TIMEOUT = 10000; // 请求超时时间(毫秒) -// 生成随机的bid Cookie值 -function generateBid() { - const chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; - let result = ''; - for (let i = 0; i < 11; i++) { - result += chars.charAt(Math.floor(Math.random() * chars.length)); - } - return result; -} - // 添加延迟函数 function delay(ms: number) { return new Promise(resolve => setTimeout(resolve, ms)); @@ -100,36 +90,18 @@ export const GET: APIRoute = async ({ request }) => { try { let doubanUrl = ''; if (type === 'book') { - doubanUrl = `https://book.douban.com/people/${doubanId}/collect?start=${start}&sort=time&rating=all&filter=all&mode=grid`; + doubanUrl = `https://book.douban.com/people/${doubanId}/collect?start=${start}`; } else { - doubanUrl = `https://movie.douban.com/people/${doubanId}/collect?start=${start}&sort=time&rating=all&filter=all&mode=grid`; + doubanUrl = `https://movie.douban.com/people/${doubanId}/collect?start=${start}`; } - // 生成随机bid - const bid = generateBid(); - - // 随机化一些请求参数,减少被检测的风险 - const userAgents = [ - 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36', - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Safari/605.1.15', - 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36', - 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0' - ]; - - const randomUserAgent = userAgents[Math.floor(Math.random() * userAgents.length)]; - // 使用带超时的fetch发送请求 const response = await fetchWithTimeout(doubanUrl, { headers: { - 'User-Agent': randomUserAgent, - 'Sec-Fetch-Site': 'none', - 'Sec-Fetch-Mode': 'navigate', - 'Sec-Fetch-User': '?1', - 'Sec-Fetch-Dest': 'document', - 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7', + 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36', + 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8', - 'Cache-Control': 'max-age=0', - 'Cookie': `bid=${bid}` + 'Cookie': `bid=doubanAPIClient` } }, REQUEST_TIMEOUT); diff --git a/src/pages/books.astro b/src/pages/books.astro index d13dc4e..8f2f1c7 100644 --- a/src/pages/books.astro +++ b/src/pages/books.astro @@ -1,7 +1,6 @@ --- import Layout from "@/components/Layout.astro"; import MediaGrid from "@/components/MediaGrid.tsx"; -import { DOUBAN_ID } from "@/consts"; --- diff --git a/src/pages/movies.astro b/src/pages/movies.astro index 64e70a4..df5c694 100644 --- a/src/pages/movies.astro +++ b/src/pages/movies.astro @@ -1,7 +1,6 @@ --- import Layout from "@/components/Layout.astro"; import MediaGrid from "@/components/MediaGrid.tsx"; -import { DOUBAN_ID } from "@/consts.ts"; --- diff --git a/src/pages/other.astro b/src/pages/other.astro index 438e501..2c57412 100644 --- a/src/pages/other.astro +++ b/src/pages/other.astro @@ -1,27 +1,51 @@ --- import Layout from "@/components/Layout.astro"; import { Countdown } from "@/components/Countdown"; -import WorldHeatmap from '@/components/WorldHeatmap'; -import { VISITED_PLACES } from '@/consts'; +import WorldHeatmap from "@/components/WorldHeatmap"; +const VISITED_PLACES = [ + "中国-黑龙江", + "中国-吉林", + "中国-辽宁", + "中国-北京", + "中国-天津", + "中国-广东", + "中国-西藏", + "中国-河北", + "中国-山东", + "中国-湖南", + "中国-重庆", + "中国-四川", + "马来西亚", + "印度尼西亚", + "泰国", +]; --- -
-
-

距离退休还有

-
- -
-
- -
-

我的旅行足迹

-
- -
-
-
-
\ No newline at end of file +
+
+

距离退休还有

+
+ +
+
+ +
+

我的旅行足迹

+
+ +
+
+
+ + diff --git a/src/plugins/sitemap-integration.js b/src/plugins/sitemap-integration.js new file mode 100644 index 0000000..98c62c0 --- /dev/null +++ b/src/plugins/sitemap-integration.js @@ -0,0 +1,515 @@ +// 自定义 Sitemap 集成 +// 用于生成带 XSLT 样式表的 sitemap.xml + +import fs from 'node:fs/promises'; +import { readFileSync, existsSync } from 'node:fs'; +import path from 'node:path'; +import { SITE_URL } from '../consts'; + +// 转义XML特殊字符 +function escapeXml(unsafe) { + if (!unsafe) return ''; + return unsafe.toString().replace(/[<>&'"]/g, c => { + switch (c) { + case '<': return '<'; + case '>': return '>'; + case '&': return '&'; + case '\'': return '''; + case '"': return '"'; + default: return c; + } + }); +} + +// 生成带XSLT的XML +function generateXmlWithXslt(entries) { + return ` + + +${entries.map(entry => ` + ${entry.url} + ${entry.priority} + `).join('\n')} +`; +} + +// 生成XSLT样式表 +function generateXsltStylesheet(entries) { + return ` + + + + + + + + 网站地图 + + + + + + + + +
+

此网站地图包含 个 URL

+
+ +
+
+

总页面数

+

+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
URL优先级
+ + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + ${entries.map(entry => ``).join('\n ')} + +
`; +} + +// 主集成函数 +export function customSitemapIntegration() { + return { + name: 'custom-sitemap-integration', + hooks: { + // 开发服务器钩子 - 为开发模式添加虚拟API路由 + 'astro:server:setup': ({ server }) => { + // 为 sitemap 相关文件提供虚拟路由 + server.middlewares.use((req, res, next) => { + // 检查请求路径是否是 sitemap 相关文件 + if (req.url === '/sitemap.xml' && req.method === 'GET') { + console.log(`虚拟路由请求: ${req.url}`); + + // 尝试返回已构建好的sitemap.xml文件 + const distPath = path.join(process.cwd(), 'dist/client/sitemap.xml'); + + if (existsSync(distPath)) { + try { + const xmlContent = readFileSync(distPath, 'utf-8'); + res.setHeader('Content-Type', 'application/xml'); + res.end(xmlContent); + } catch (error) { + res.statusCode = 500; + res.end('读取 sitemap.xml 文件时出错'); + } + } else { + res.statusCode = 404; + } + return; + } + + if (req.url === '/sitemap.xsl' && req.method === 'GET') { + console.log(`虚拟路由请求: ${req.url}`); + + // 尝试返回已构建好的sitemap.xsl文件 + const distPath = path.join(process.cwd(), 'dist/client/sitemap.xsl'); + + if (existsSync(distPath)) { + try { + const xslContent = readFileSync(distPath, 'utf-8'); + res.setHeader('Content-Type', 'application/xslt+xml'); + res.end(xslContent); + console.log('已返回构建好的 sitemap.xsl 文件'); + } catch (error) { + console.error('读取 sitemap.xsl 文件时出错:', error); + res.statusCode = 500; + res.end('读取 sitemap.xsl 文件时出错'); + } + } else { + console.log('未找到构建好的 sitemap.xsl 文件,请先运行 npm run build'); + res.statusCode = 404; + res.end('未找到 sitemap.xsl 文件,请先运行 npm run build'); + } + return; + } + + // 不是 sitemap 相关请求,继续下一个中间件 + next(); + }); + }, + + // 构建完成钩子 - 生成 sitemap 文件 + 'astro:build:done': async ({ pages, dir }) => { + console.log('生成自定义 Sitemap...'); + + try { + // 获取构建目录路径 + let buildDirPath; + + // 直接处理URL对象 + if (dir instanceof URL) { + buildDirPath = dir.pathname; + // Windows路径修复 + if (process.platform === 'win32' && buildDirPath.startsWith('/') && /^\/[A-Z]:/i.test(buildDirPath)) { + buildDirPath = buildDirPath.substring(1); + } + } else { + buildDirPath = String(dir); + } + + console.log(`构建目录路径: ${buildDirPath}`); + + // 收集所有页面信息 + const sitemapEntries = []; + + for (const page of pages) { + // 过滤掉API路径 + if (page.pathname.includes('/api/')) { + continue; + } + + const url = new URL(page.pathname, SITE_URL).toString(); + + // 解码URL + const urlObj = new URL(url); + const decodedPathname = decodeURIComponent(urlObj.pathname); + const decodedUrl = `${urlObj.protocol}//${urlObj.host}${decodedPathname}`; + + // 确定页面优先级 + let priority = 0.7; + + // 首页最高优先级 + if (page.pathname === '/') { + priority = 1.0; + } + // 文章列表页次高优先级 + else if (page.pathname === '/articles/') { + priority = 0.9; + } + // 文章页面 + else if (page.pathname.includes('/articles/')) { + priority = 0.8; + } + + sitemapEntries.push({ + url, + decodedUrl, + priority + }); + } + + // 按优先级排序 + sitemapEntries.sort((a, b) => b.priority - a.priority); + + // 生成带XSLT的XML文件 + const xmlContent = generateXmlWithXslt(sitemapEntries); + + // 写入sitemap.xml + await fs.writeFile(path.join(buildDirPath, 'sitemap.xml'), xmlContent); + console.log('已生成 sitemap.xml'); + + // 写入XSLT样式表文件 + await fs.writeFile(path.join(buildDirPath, 'sitemap.xsl'), generateXsltStylesheet(sitemapEntries)); + console.log('已生成 sitemap.xsl'); + + } catch (error) { + console.error('生成 Sitemap 时出错:', error); + } + } + } + }; +} \ No newline at end of file