@effector/redux-devtools-adapter

中文文档
0.2.0发布于 2023/12/02MITTypeScriptESM + CJS零依赖构建来源已验证近 30 天下载 6930

Simple adapter to connect Effector's Inspect API to Redux DevTools

原始使用文档
文档目录8 节
  1. Installation
  2. Usage
  3. Prepare metadata
  4. In the code
  5. stateTab
  6. In the Next.js - Pages Router
  7. In the Next.js - App Router
  8. Release process

redux-devtools-adapter

Simple adapter to connect Effector's Inspect API to Redux DevTools, extracted from the old effector-logger project.

image

Installation

yarn add -D @effector/redux-devtools-adapter

Usage

Prepare metadata

To make logs more useful we need additional metadata (like names, locations in the code, etc), which is provided by one of the effector plugins.

Babel-plugin

Babel-plugin is built-in in the effector package.

Just add it to your babel configuration.

{
  "plugins": ["effector/babel-plugin"]
}

It is also useful to enable loc generation for dev environment, to see for exact locations of samples and other operators in the code.

{
  "plugins": [["effector/babel-plugin", { "addLoc": true }]]
}

Read the docs

SWC Plugin

Read effector SWC plugin documentation

In the code

Just call attachReduxDevTools() somewhere in your project's entrypoint and you are good to go.

// e.g. src/main.ts
import { attachReduxDevTools } from "@effector/redux-devtools-adapter";

attachReduxDevTools();

You can also provide some additional configuration. All fields are optional.

name

Type: string. Will be visible in the Redux Devtools

scope

Type: Scope Effector's Scope from Fork API, if your app uses it.

See the docs and the article

trace

Type: boolean Enables traces of effector's calculations in the actions. Disabled by default.

batch

Type: boolean | { size: number; latency: number; }. Enables batching of logs at the adapter's side. Redux DevTools are trying to print each and every log they get, which may cause performance issues in the large apps.

With batching enabled adapter sends logs only once in latency milliseconds and with number of logs no more than size number. This means that only last size number of logs will be visible in the DevTools at all times.

Enabled by default, defautls are: last 100 logs with latency 500 milliseconds.

stateTab

Type: boolean. Enables state tab with state of all stores at each point in time. May cause performance issues in the large apps. Disabled by default.

devToolsConfig

Config for Redux DevTools, passed directly to the connect call. See the official docs.

Example of configurated call:

import { attachReduxDevTools } from "@effector/redux-devtools-adapter";

attachReduxDevTools({
  name: "My App",
  scope,
  trace: true,
});

In the Next.js - Pages Router

Read effector/next documentation

In the Next.js - App Router

Read effector/next documentation

Release process

  1. Check out the draft release.
  2. All PRs should have correct labels and useful titles. You can review available labels here.
  3. Update labels for PRs and titles, next manually run the release drafter action to regenerate the draft release.
  4. Review the new version and press "Publish"
  5. If required check "Create discussion for this release"

版本与发布记录

@effector/redux-devtools-adapter 共发布 8 个版本,首次发布于 2023/04/28;过去 12 个月发布了 0 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.2.0latest2023/12/022 年前
0.1.62023/07/283 年前
0.1.52023/04/303 年前
0.1.42023/04/293 年前
0.1.32023/04/293 年前
0.1.22023/04/293 年前

关于 @effector/redux-devtools-adapter 的常见问题

@effector/redux-devtools-adapter 是什么?

Simple adapter to connect Effector's Inspect API to Redux DevTools

如何安装 @effector/redux-devtools-adapter?

在项目目录运行 npm install @effector/redux-devtools-adapter,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:effector(^22.8.1 || ^23.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@effector/redux-devtools-adapter 支持 TypeScript 吗?

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

@effector/redux-devtools-adapter 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@effector/redux-devtools-adapter 可以商用吗?

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

@effector/redux-devtools-adapter 的下载量有多少?

根据 npm 官方下载统计,@effector/redux-devtools-adapter 在 2026/10/13 – 2026/11/11 这 30 天内被下载 6,930 次,日均约 231 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@effector/redux-devtools-adapter 还在维护吗?

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