@flags-sdk/hypertune

中文文档
0.3.5发布于 2026/09/21MITTypeScriptESM + CJS构建来源已验证近 30 天下载 9050

A HyperTune adapter for the Flags SDK

此软件包已被标记为弃用

The Hypertune adapter is deprecated and no longer receives updates. See https://flags-sdk.dev/providers for alternatives.

原始使用文档
文档目录4 节
  1. Setup
  2. Provider Instance
  3. Required Environment Variables
  4. Documentation

Flags SDK — Hypertune Provider

Deprecated. This adapter no longer receives updates. Use Vercel Flags or another featured provider for new projects.

The Hypertune adapter for the Flags SDK

Setup

The Hypertune provider is available in the @flags-sdk/hypertune module. You can install it with

pnpm i @flags-sdk/hypertune

Provider Instance

You must use the code generation powered by npx hypertune to create an adapter instance. Use createHypertuneAdapter from @flags-sdk/hypertune as shown below:

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: "[email protected]",
    },
  };
});

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" },
  ],
});

Required Environment Variables

# 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"

Documentation

Please check out the Hypertune Adapter reference for more information.

版本与发布记录

@flags-sdk/hypertune 共发布 12 个版本,首次发布于 2024/12/13;过去 12 个月发布了 3 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.3.5latest2026/09/211 个月前
0.3.42026/08/123 个月前
0.3.32026/08/053 个月前
0.3.22025/11/061 年前
0.3.2-fcec5ecd-20251106144952snapshot2025/11/061 年前
0.3.12025/10/251.1 年前

关于 @flags-sdk/hypertune 的常见问题

@flags-sdk/hypertune 是什么?

A HyperTune adapter for the Flags SDK注意:该包已被作者标记为弃用——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。作者已将其标记为弃用,新项目建议寻找替代方案。