- 收藏功能:favorite server actions + FavoritesProvider/FavoriteButton(乐观更新、未登录引导登录),列表卡片/详情页收藏按钮,仪表盘"我的收藏" - 前台定价筛选(免费/免费增值/付费)与卡片定价徽标;首页"精选"改为查询 featured=true,不足时按最新补齐 - /category/[slug] 从 redirect 壳子改为真实落地页:分类双语描述 + 工具网格 + 完整 metadata + JSON-LD - ISR:首页/工具详情/分类页 revalidate 3600 + generateStaticParams,[locale] layout 补 generateStaticParams;verify-email 与 reset-password 的 useSearchParams 包 Suspense - 新增共享 ToolLogo 组件(next/image 优化 + data URL 降级 + 首字母占位),核心页面裸 img 全部替换;next.config 补 remotePatterns(R2 域名/Google favicon/https 通配) - getCategoriesWithCount 只统计 published 工具;featured-tools 文案迁移至 next-intl - Newsletter:footer 订阅表单 + 落库 + 可选同步 Resend Audience + 退订路由 - Docker:多阶段 Dockerfile(standalone)+ docker-compose(含 Postgres)+ 构建期数据库不可用的容错回退 - i18n:新增 pnpm i18n:check 一致性检查并补齐双语缺失键 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
82 lines
2.0 KiB
JavaScript
82 lines
2.0 KiB
JavaScript
import fs from "node:fs";
|
|
import path from "node:path";
|
|
|
|
import rehypePrism from "@mapbox/rehype-prism";
|
|
import nextMDX from "@next/mdx";
|
|
import remarkGfm from "remark-gfm";
|
|
import createNextIntlPlugin from 'next-intl/plugin';
|
|
|
|
const withNextIntl = createNextIntlPlugin('./src/lib/i18n.ts');
|
|
|
|
const pnpmManagedPath = path.join(process.cwd(), "node_modules", ".pnpm");
|
|
const snapshotManagedPaths = fs.existsSync(pnpmManagedPath) ? [pnpmManagedPath] : [];
|
|
|
|
/** @type {import('next').NextConfig} */
|
|
const nextConfig = {
|
|
// Docker 部署使用 standalone 输出
|
|
output: "standalone",
|
|
images: {
|
|
remotePatterns: [
|
|
{
|
|
protocol: "https",
|
|
hostname: "i.pravatar.cc",
|
|
},
|
|
{
|
|
protocol: "https",
|
|
hostname: "images.unsplash.com",
|
|
},
|
|
{
|
|
protocol: "https",
|
|
hostname: "a.offerget.pro",
|
|
},
|
|
{
|
|
protocol: "https",
|
|
hostname: "lh3.googleusercontent.com",
|
|
},
|
|
// Google favicon 服务(种子数据 logo 来源之一)
|
|
{
|
|
protocol: "https",
|
|
hostname: "www.google.com",
|
|
},
|
|
// R2/S3 公共访问域名(上传的 logo/封面)
|
|
...(process.env.STORAGE_PUBLIC_URL
|
|
? [
|
|
{
|
|
protocol: "https",
|
|
hostname: new URL(process.env.STORAGE_PUBLIC_URL).hostname,
|
|
},
|
|
]
|
|
: []),
|
|
// 工具 logo 指向各工具官网的 favicon,域名不可枚举,放开 https 通配
|
|
{
|
|
protocol: "https",
|
|
hostname: "**",
|
|
},
|
|
],
|
|
},
|
|
pageExtensions: ["ts", "tsx", "mdx"],
|
|
turbopack: {
|
|
rules: {
|
|
'*.mdx': {
|
|
loaders: ['@mdx-js/loader'],
|
|
as: '*.js',
|
|
},
|
|
},
|
|
},
|
|
webpack(config) {
|
|
config.snapshot ??= {};
|
|
config.snapshot.managedPaths = snapshotManagedPaths;
|
|
return config;
|
|
},
|
|
};
|
|
|
|
const withMDX = nextMDX({
|
|
extension: /\.mdx?$/,
|
|
options: {
|
|
remarkPlugins: [remarkGfm],
|
|
rehypePlugins: [rehypePrism],
|
|
},
|
|
});
|
|
|
|
export default withNextIntl(withMDX(nextConfig));
|