@aphrody/ next-bun (英语)
下一个Js在Bun,为下16。 一个包,几个切入点:
| 入境点 | 它会做什么 |
|---|---|
next-bun dev|build|start … | 运行应用程序自己的 next 作为 bun --bun next … 带有 node 这是Bun先打开的 PATH接下来的产卵会回到节点. |
next-bun patch|check [dir] | 补丁 next 16.1.6起(最多16.4.0起和16.5.0起),所以 next build 构建 Pages 路由器和 App 路由器 Bun.build (实验性,见 withBun) (中文(简体) ). |
next-bun codemod <ids|group|all> <dir> | 接下来的16和Tailwind 4编码器(--list, (中文(简体) ), --apply, (中文(简体) ), --json) (中文(简体) ). next-bun pages-hints <dir> 列表 Pages 路由器 → App 路由器提示. |
@aphrody/next-bun | withBun(config, options):工作空间根,共享涡轮包/网包别名和去dup,TypeScript-source包已转接, next start 被钉住的建筑; Bun.building for next build 除非 bundler: "turbopack"。 。 。 . |
@aphrody/next-bun/run | runNext(argv, cwd), (中文(简体) ), nextCommand(args, cwd, shim), (中文(简体) ), bunNodeShim(dir, bun), (中文(简体) ), nextBin(cwd), (中文(简体) ), bunExecutable()。 。 。 . |
next-bun standalone <dir>, (中文(简体) ), @aphrody/next-bun/standalone | flattenStandalone(dir){\fn黑体\fs22\bord1\shad0\3aHBE\4aH00\fscx67\fscy66\2cHFFFFFF\3cH808080}Bun的独家店铺 {\fn黑体\fs22\bord1\shad0\3aHBE\4aH00\fscx67\fscy66\2cHFFFFFF\3cH808080}这家店 output: "standalone" 树,没有符号链接了. |
@aphrody/next-bun/codemods | CODEMODS, (中文(简体) ), NEXT16_CODEMODS, (中文(简体) ), TAILWIND4_CODEMODS, (中文(简体) ), CODEMOD_GROUPS, (中文(简体) ), selectCodemods, (中文(简体) ), runCodemods, (中文(简体) ), tailwindConfigToCss。 。 。 . |
@aphrody/next-bun/codemods/cli | runCodemodCli(argv, { program, codemods, groupHelp }),将编码器CLI与外置编码器相嵌入. |
@aphrody/next-bun/testing | instant(page, fn, { baseURL }): Next.js 即时导航测试 Playwright 页面和 CDP 后置页面(_cdp 或者说 _send) (中文(简体) ). |
代码和测试入站点为TypeScript并运行如在Bun上.
withBun
与 @aphrody/next (单位:千美元)aphrody-labs/next.js (英语)),"包子"装入 next build
(单位:千美元)next/dist/build/bun-build, (中文(简体) ), NEXT_BUN=1Turbopack 开始它的工人的运行时间 装入它。 也没有 next-bun patch 也没有
页:1 node 在那里需要Shim; 两者都留在Vercel那里 next。 。 。 .
import { withBun } from "@aphrody/next-bun";
export default withBun(nextConfig, {
bundler: "turbopack", // leave the bundler to Next; the default "bun" builds with Bun.build
projectDir: __dirname,
alias: { "next-intl/config": "./src/i18n/request.ts" }, // Turbopack and webpack alike
dedupe: ["prosemirror-transform"], // one installed copy for every importer
});
在每一个阶段 withBun 另设 turbopack.root 财务报告和审定财务报表 outputFileTracingRoot 到工作空间根时
未设置( Bun 的孤立链接器将软件包保存在根中) node_modules/.bun),添加每个依赖
船型脚本来源(exports 指点 .ts编号 :.tsx,转接) transpilePackages
除非是在 serverExternalPackages,并制作 next start 重复使用 assetPrefix 财务报告和审定财务报表 deploymentId
(单位:千美元)<distDir>/required-server-files.jsonTurbopack 既会烤入客户端运行时间,也会烤出一个
不同于构建的服务器环境为 HTML 服务,其块永远不会加载。 每次重写
拥有关闭的选项( n)root: false, (中文(简体) ), transpileSources: false, (中文(简体) ), freezeBuildConfig: false) (中文(简体) ).
reactCompiler, (中文(简体) ), typedRoutes 财务报告和审定财务报表 cacheComponents 配置时设置同名的下十六个密钥
让他们不固定. tauri 将构建变成一个静态导出 Tauri 网络视图负载( Nameoutput: "export", (中文(简体) ),
未优化的图像,跟踪鞭打, 没有缓存组件, tauri.env {\fn黑体\fs22\bord1\shad0\3ahbe\4ah00\fscx67\fscy66\2chffffff\3ch808080}在化妆品下烤的 env,则
dev 服务器作为外部生产的资产前缀; tauri: "auto" 只有当 Tauri CLI 运行建设时它才会有
(单位:千美元)isTauriBuild()) (中文(简体) ). 密钥组合总是赢得.
CSS和尾风CSS
Bun. 构建路径捆绑全局样式表( 从 pages/_app)和CSS模块,并列出每个模块
页面样式表 build-manifest.json 接下来是 <link rel="stylesheet">。 。 。 . plugins 添加 Bun 选项
两种建筑的插件; tailwind 添加 @aphrody/bun-plugin-tailwind 从
项目(true 或选择 base 默认为 projectDir:
module.exports = withBun(nextConfig, {
projectDir: __dirname,
tailwind: { theme: "m3" },
});
有了涡轮包或网络包,同一引擎运行于PostCSS插件:
// postcss.config.mjs
export default { plugins: { "@aphrody/bun-plugin-tailwind/postcss": {} } };
@aphrody/next-bun/app: 无下一条的 App 路由器
接下来的Js app/ 常规(页面、版式、模板、加载、出错、未找到、路由处理器、路由组、动态和
囊括所有片段、机器人/物品/动作, proxy.ts 中间软件),包含 React 服务器组件,服务器动作,流出 SSR
和静电发电,由三所建造 Bun.build 出入证(rsc、客户端、sr) Bun.serve。 。 。 . next/link, (中文(简体) ),
next/navigation, (中文(简体) ), next/headers, (中文(简体) ), next/server, (中文(简体) ), next/cache 财务报告和审定财务报表 next/image 映射到 app/需求 react, (中文(简体) ),
react-dom 财务报告和审定财务报表 react-server-dom-parcel 19.
import {
buildApp,
prerenderApp,
serveApp,
devApp,
compileAppRouter,
} from "@aphrody/next-bun/app";
await buildApp({ root: process.cwd(), outDir: "dist", clientPlugins: [] });
await prerenderApp("dist");
await serveApp({ outDir: "dist", port: 3000 });
runAppCommand("dev" | "build" | "start", project, flags) 包起来进行CLI; compileAppRouter 链接到一个
可执行文件 dockerAppRouter 写入 Docker 上下文.
@aphrody/next-bun/crawl
纯函数用于一个站点的爬行器创建文件,从路由处理器返回或在构建时写入:
sitemapXml(routes, origin) (项目0.9、去重复和分类), robotsTxt({ origin, rules, sitemaps })
(RFC 9309), (中文(简体) ), llmsTxt({ origin, name, summary, details, sections }) (单位:千美元)维基百科中的相关条目: 维基语录链接:名人名言和
jsonLd(data) 用于内置 <script type="application/ld+json">。 。 。 .
import { sitemapXml } from "@aphrody/next-bun/crawl";
export const GET = () =>
new Response(sitemapXml(["/", "/docs"], "https://example.com"), {
headers: { "content-type": "application/xml" },
});
这个 node 嘘
bunNodeShim() 设置一个 node (Bun在Windows上的硬链接或副本,其他的同义链接)在临时目录和 next-bun 预留给
PATH涡轮包装开始其PostCSS和网络包装装货工人通过 Command::new("node") (单位:千美元) process_pool 后端在每一个
@next/swc 二进制,Linux,macOS和Windows). 没有 node 打开 PATH 和通往 next,下一个16.1.6和
16.5.0-canary.4在 Linux (Docker) 和 Windows 上以"喷出节点集合过程"出故障;使用一个真正的节点.js PATH 工人会奔跑
就在这. bun --bun node_modules/next/dist/bin/next (一个赤裸的相对路径) 工作没有shim 仅仅因为Bun然后运行它作为一个
包件并添加自己的 bun-node 嘘. test/integration/next-app 通过 next-bun 与每个 node 从 PATH。 。 。 .
测试
纯 JS, 用安装的 Bun 运行( 不需要调试构建 ):
bun test test/integration/next-bun/
bun test test/integration/next-app/test/next-app.test.ts
bun test test/integration/next-bun-pages/test/next-bun-pages.test.ts
bun test test/integration/next-bun-app/test/next-bun-app.test.ts
计划和历史: 文件/PLAN.md。 。 。 .