# @flags-sdk/hypertune 中文文档

规范地址：https://npmcn.com/package/%40flags-sdk/hypertune/

版本：0\.3\.5
npm 元数据更新时间：2026-09-21T11:16:56.984Z
中文译文更新时间：2026-11-14T21:12:09.618Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40flags-sdk/hypertune
原文对照：https://npmcn.com/package/%40flags-sdk/hypertune/?lang=original
项目主页：https://github.com/vercel/flags#readme
源码仓库：https://github.com/vercel/flags

弃用说明：The Hypertune adapter is deprecated and no longer receives updates\. See https://flags-sdk\.dev/providers for alternatives\.

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：41.3 kB，20 个文件
- 模块格式：ESM + CJS
- TypeScript 类型：包内自带
- 运行依赖：2 个
- 首次发布：2024-12-13T13:27:46.036Z
- 最新版本发布：2026-09-21T11:16:56.603Z
- 近 30 天下载量：9050（2026-10-15 至 2026-11-13，npm 官方下载统计）
- 已发布版本数：12（近 12 个月 3 个）

## 中文简介

一个用于旗舰SDK的超Tune适配器

## 安装

```sh
npm install @flags-sdk/hypertune
```

也可以使用：`pnpm add @flags-sdk/hypertune`、`yarn add @flags-sdk/hypertune`、`bun add @flags-sdk/hypertune`

## README

# 旗子 SDK — 超调谐提供者

> **堕地.** 此适配器不再收到更新. 使用 [Vercel 旗帜](https://flags-sdk.dev/providers/vercel) 或另一个 [有特色的提供者](https://flags-sdk.dev/providers) 新项目.

这个 [超调适配器](https://flags-sdk.dev/docs/api-reference/adapters/hypertune) 联 合 国 [旗帜 SDK](https://flags-sdk.dev/)

## 设置

Hypertune 提供者在 `@flags-sdk/hypertune` 模块。 你可以安装它

```bash
pnpm i @flags-sdk/hypertune
```

## 提供者实例

您必须使用由 : `npx hypertune` 创建适配器实例. 使用 `createHypertuneAdapter` 从 `@flags-sdk/hypertune` 如下所示:

```ts
import { createHypertuneAdapter } from "@flags-sdk/hypertune";
import { Identify } from "flags";
import { dedupe, flag } from "flags/next";
/** Generated with `npx hypertune` */
import {
  createSource,
  flagFallbacks,
  vercelFlagDefinitions as flagDefinitions,
  Context,
  FlagValues,
} from "./generated/hypertune";

const identify: Identify<Context> = dedupe(async ({ headers, cookies }) => {
  return {
    environment: process.env.NODE_ENV,
    user: {
      id: "e23cc9a8-0287-40aa-8500-6802df91e56a",
      name: "Example User",
      email: "user@example.com",
    },
  };
});

const hypertuneAdapter = createHypertuneAdapter<FlagValues, Context>({
  createSource,
  flagFallbacks,
  flagDefinitions,
  identify,
});

/** Use the adapter to generate flag declarations for use in your app's framework */
export const showSummerBannerFlag = flag(
  hypertuneAdapter.declarations.summerSale,
);

export const showFreeDeliveryBannerFlag = flag(
  hypertuneAdapter.declarations.freeDelivery,
);

export const proceedToCheckoutColorFlag = flag(
  hypertuneAdapter.declarations.proceedToCheckout,
);

/**
 * NOTE: You can provide specific options for flag overrides.
 *
 * However, using enums in Hypertune will provide these automatically.
 */
export const delayFlag = flag({
  ...hypertuneAdapter.declarations.delay,
  options: [
    { value: 0, label: "No delay" },
    { value: 1_000, label: "1 second" },
    { value: 2_000, label: "2 seconds" },
    { value: 3_000, label: "3 seconds" },
  ],
});
```

## 需要的环境变量

```bash
# Required
NEXT_PUBLIC_HYPERTUNE_TOKEN="123="

# For use with precompute, encrypted flag values, overrides, and the Flags Explorer
FLAGS_SECRET="ReplaceThisWith32RandomBytesBase64UrlString"

# Optional: automatically configure with a VercelGlobalConfigInitDataProvider
EXPERIMENTATION_CONFIG="ecfg_abc"
EXPERIMENTATION_CONFIG_ITEM_KEY="hypertune_xyz"
```

## 文档

请检查一下 [超调解调器引用](https://flags-sdk.dev/docs/api-reference/adapters/hypertune) 更多信息.

## 常见问题

### @flags-sdk/hypertune 是什么？

一个用于旗舰SDK的超Tune适配器注意：该包已被作者标记为弃用——The Hypertune adapter is deprecated and no longer receives updates\. See https://flags-sdk\.dev/providers for alternatives\.

### 如何安装 @flags-sdk/hypertune？

在项目目录运行 npm install @flags-sdk/hypertune，或使用 pnpm add / yarn add / bun add。

### @flags-sdk/hypertune 支持 TypeScript 吗？

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

### @flags-sdk/hypertune 支持 ESM 还是 CommonJS？

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

### @flags-sdk/hypertune 可以商用吗？

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

### @flags-sdk/hypertune 的下载量有多少？

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

### @flags-sdk/hypertune 还在维护吗？

最新版本 0\.3\.5 发布于 2026/09/21（1 个月前）；至今共发布 12 个版本，其中过去 12 个月发布了 3 个；首次发布于 2024/12/13。作者已将其标记为弃用，新项目建议寻找替代方案。

