@farm.js/devtools

中文文档
0.1.48发布于 2026/11/01MITTypeScriptES Module

Development workspace inspector for Farm.js routes, runtime, and browser modules

原始使用文档

@farm.js/devtools

Farm's official DevTools: a development-only workspace for Farm.js routes, APIs, integrations, runtime diagnostics, and browser modules. It replaces the deprecated built-in dashboard. Uses the Farm logo, bundled Geist fonts, light/dark themes, and syntax-highlighted source and JSON with safe copy controls.

import { defineConfig } from "@farm.js/core";
import { devtools } from "@farm.js/devtools";

export default defineConfig({ plugins: [devtools()] });

Install with pnpm add -D @farm.js/devtools. Open the lower-left launcher or press Command/Ctrl + Shift + . during farm dev. The UI loads only when opened. The plugin is removed from production configuration, with no production client or server endpoint.

Options: launcher?: boolean, shortcut?: string | false, inspect?: boolean. Registration is the opt-in; there is no enabled option. Without the plugin, apps fall back to the deprecated built-in dashboard. Do not combine it with devtools: false.

Plugins lists active Farm plugins in the plugin manager's execution order (pre, normal, post), with versions and declared server/client hook names. It includes legacy hook names as declared. This is registration metadata, not a call trace; parallel hooks can finish in a different order. Plugin configuration, public data, hook source, and private state are never serialized.

Inspect compares the current application source with Vite's cached browser output, not individual plugin stages. Only already-transformed, in-project browser source is eligible; virtual/server-only modules, dependencies, hidden paths, and outside-project symlinks are excluded. Limits: 500 listed modules, 1 MiB per source/output, 1,500 displayed lines. Copy includes the full bounded text. While Inspect is open, the selected module refreshes after Vite completes an HMR update. Pending updates, failures, and disconnects label previously displayed code as stale. This reuses the app's Vite connection, without polling or a second socket. Other views keep their filters and selection; use Refresh for their latest snapshot. A full page reload closes the panel with the app.

DevTools is read-only, not an authentication boundary for a public development server. Environment values are absent from snapshots; literals in client source are not redacted. Keep development servers private. Assets and highlighting are local, without CDN calls.

Full documentation: https://farmjs.dev/docs/plugins/devtools

This package is independently versioned and is picked up by the workspace build, test, packing, and publishing scripts. No starter dependency is added automatically.

版本与发布记录

@farm.js/devtools 共发布 58 个版本,首次发布于 2026/09/15;过去 12 个月发布了 58 个版本。

版本发布日期距今
0.1.48latest2026/11/012 天前
0.1.472026/10/313 天前
0.1.462026/10/313 天前
0.1.452026/10/313 天前
0.1.442026/10/313 天前
0.1.432026/10/304 天前

其他发布通道:beta → 0.1.3-beta.0。

关于 @farm.js/devtools 的常见问题

@farm.js/devtools 是什么?

用于Farm.js路由、运行时和浏览器模块的开发工作区检查器

如何安装 @farm.js/devtools?

在项目目录运行 npm install @farm.js/devtools,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@farm.js/core(>=0.1.28 <0.2.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@farm.js/devtools 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@farm.js/devtools 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@farm.js/devtools 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.13.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@farm.js/devtools 可以商用吗?

@farm.js/devtools 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@farm.js/devtools 还在维护吗?

最新版本 0.1.48 发布于 2026/11/01(2 天前);至今共发布 58 个版本,其中过去 12 个月发布了 58 个;首次发布于 2026/09/15。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。