flags-sdk
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseFlags SDK
Flags SDK
The Flags SDK ( npm package) is a feature flags toolkit for Next.js and SvelteKit. It turns each feature flag into a callable function, works with any flag provider via adapters, and keeps pages static using the precompute pattern. Vercel Flags is the first-party provider, letting you manage flags from the Vercel dashboard or the CLI.
flagsvercel flags- Docs: https://flags-sdk.dev
- Repo: https://github.com/vercel/flags
Flags SDK( npm包)是一款面向Next.js和SvelteKit的功能标志工具包。它将每个功能标志转换为可调用函数,通过适配器兼容任意标志提供商,并利用预计算模式保持页面静态化。Vercel Flags是官方提供商,支持通过Vercel控制台或 CLI管理标志。
flagsvercel flagsCore concepts
核心概念
Flags as code
标志即代码
Each flag is declared as a function. No string keys at call sites:
ts
import { flag } from 'flags/next';
export const exampleFlag = flag({
key: 'example-flag',
decide() { return false; },
});
const value = await exampleFlag();每个标志都声明为一个函数,调用时无需使用字符串键:
ts
import { flag } from 'flags/next';
export const exampleFlag = flag({
key: 'example-flag',
decide() { return false; },
});
const value = await exampleFlag();Server-side evaluation
服务端求值
Flags evaluate server-side to avoid layout shift, keep pages static, and maintain confidentiality. Combine routing middleware with the precompute pattern to serve static variants from CDN.
标志在服务端进行求值,避免布局偏移、保持页面静态并确保数据保密。结合路由中间件与预计算模式,可从CDN提供静态变体页面。
Adapter pattern
适配器模式
Adapters replace and on a flag declaration, connecting your flags to a provider. Vercel Flags () is the first-party adapter. Third-party adapters are available for Statsig, LaunchDarkly, PostHog, and others.
decideorigin@flags-sdk/vercelts
import { flag } from 'flags/next';
import { vercelAdapter } from '@flags-sdk/vercel';
export const exampleFlag = flag({
key: 'example-flag',
adapter: vercelAdapter,
});Version note: The SDK is published as(renamed fromflags; that old name still appears in changelog history).@vercel/flags4.2.0+ accepts the adapter factory by reference (flags) and resolves it once per declaration. Older versions require calling it (adapter: vercelAdapter). The called form still works on new versions, so prefer the shorthand unless you're targetingadapter: vercelAdapter()< 4.2.0.flags
适配器可替换标志声明中的和方法,将标志连接到对应提供商。Vercel Flags()是官方适配器,同时支持Statsig、LaunchDarkly、PostHog等第三方适配器。
decideorigin@flags-sdk/vercelts
import { flag } from 'flags/next';
import { vercelAdapter } from '@flags-sdk/vercel';
export const exampleFlag = flag({
key: 'example-flag',
adapter: vercelAdapter,
});版本说明:该SDK以名义发布(原名为flags,旧名称仍会出现在变更历史中)。@vercel/flags4.2.0+版本支持直接引用适配器工厂(flags),并会在每次声明时解析一次。旧版本需要调用适配器(adapter: vercelAdapter)。调用形式在新版本中仍可正常工作,因此除非你需要兼容adapter: vercelAdapter()< 4.2.0版本,否则建议使用简写形式。flags
Agent workflow: Creating a new flag
Agent工作流:创建新标志
When a user asks you to create or add a feature flag, follow these steps in order. Do not leave CLI steps as "next steps" for the user — execute them yourself.
当用户要求你创建或添加功能标志时,请按以下步骤操作。不要将CLI步骤留给用户自行完成——请你直接执行这些步骤。
Before you start
准备工作
Check the project state to adapt commands and decide which steps you can skip:
- Which lockfile is present (,
pnpm-lock.yaml,package-lock.json,yarn.lock)? → Adapt all package manager commands accordingly (bun.lockb,pnpm add,npm install,yarn add).bun add - Is in
flags? → Skip install (step 1)package.json - Does directory exist? → Project is linked, skip
.vercel/in step 2vercel link - Does contain
.env.local? → Env vars already pulled, skip step 3FLAGS= - Does (or
flags.ts,lib/flags.ts) exist? → Add to it rather than creating from scratch (step 4)src/flags.ts - Is in
@vercel/toolbar? → Skip toolbar setup (step 6)package.json - Does exist? → Flags Explorer already set up, skip step 7
app/.well-known/vercel/flags/route.ts
检查项目状态,调整命令并确定可跳过的步骤:
- 项目中存在哪种锁文件(、
pnpm-lock.yaml、package-lock.json、yarn.lock)?→ 相应调整所有包管理器命令(bun.lockb、pnpm add、npm install、yarn add)。bun add - 中是否已包含
package.json?→ 跳过安装步骤(步骤1)flags - 项目中是否存在目录?→ 项目已关联Vercel,跳过步骤2中的
.vercel/vercel link - 中是否包含
.env.local?→ 环境变量已拉取,跳过步骤3FLAGS= - 是否存在(或
flags.ts、lib/flags.ts)文件?→ 在现有文件中添加标志,而非从头创建(步骤4)src/flags.ts - 中是否包含
package.json?→ 跳过工具栏设置(步骤6)@vercel/toolbar - 是否存在?→ Flags Explorer已配置完成,跳过步骤7
app/.well-known/vercel/flags/route.ts
Steps
步骤
-
Install packages (if not already in):
package.jsonbashpnpm i flags @flags-sdk/vercel -
Register the flag with Vercel: Run.
vercel flags add <flag-key> --kind boolean --description "<description>"Prerequisite: Thecommands require the Vercel CLI to be installed and authenticated. If the Vercel CLI is not installed, runvercel flags. For authentication or linking issues, follow thepnpm i -g vercelskill if it's already available. If it isn't, suggest the user install it withvercel-cli(don't auto-install it) and rely onnpx skills add vercel/vercel@vercel-cliin the meantime.vercel <command> --helpBefore running, verify the project is linked to Vercel. Check for avercel flags adddirectory in the project root. If it doesn't exist, run.vercelfirst.vercel link -
Pull environment variables: Runto write
vercel env pullandFLAGStoFLAGS_SECRET. Without these environment variables,.env.localwill not be able to evaluate flags. This step is mandatory after creating a flag.vercelAdapter -
Declare the flag in code: Add it to(or create the file if it doesn't exist) using
flags.ts:vercelAdaptertsimport { flag } from 'flags/next'; import { vercelAdapter } from '@flags-sdk/vercel'; export const myFlag = flag({ key: 'my-flag', adapter: vercelAdapter, }); -
Use the flag: Call it in your page or component and conditionally render based on the result:tsx
import { myFlag } from '../flags'; export default async function Page() { const enabled = await myFlag(); return <div>{enabled ? 'Feature on' : 'Feature off'}</div>; } -
Set up the Vercel Toolbar (if not already present):
- Run
pnpm i @vercel/toolbar - Wrap with the toolbar plugin
next.config.ts - Render in the root layout See references/nextjs.md — Toolbar Setup for the full code.
<VercelToolbar />
- Run
-
Set up Flags Explorer (if not already present): Create— see the Flags Explorer setup section below.
app/.well-known/vercel/flags/route.ts
-
安装包(若中未包含):
package.jsonbashpnpm i flags @flags-sdk/vercel -
在Vercel中注册标志:运行。
vercel flags add <flag-key> --kind boolean --description "<description>"前提条件:命令需要安装并认证Vercel CLI。若未安装Vercel CLI,运行vercel flags。若遇到认证或关联问题,若pnpm i -g vercel技能已可用,请遵循该技能指引;若不可用,建议用户通过vercel-cli安装(不要自动安装),同时可参考npx skills add vercel/vercel@vercel-cli获取帮助。vercel <command> --help在运行之前,请确认项目已关联Vercel。检查项目根目录是否存在vercel flags add目录,若不存在,先运行.vercel。vercel link -
拉取环境变量:运行将
vercel env pull和FLAGS写入FLAGS_SECRET。没有这些环境变量,.env.local将无法求值标志。创建标志后,此步骤必须执行。vercelAdapter -
在代码中声明标志:使用将标志添加到
vercelAdapter(若文件不存在则创建):flags.tstsimport { flag } from 'flags/next'; import { vercelAdapter } from '@flags-sdk/vercel'; export const myFlag = flag({ key: 'my-flag', adapter: vercelAdapter, }); -
使用标志:在页面或组件中调用标志,并根据结果条件渲染:tsx
import { myFlag } from '../flags'; export default async function Page() { const enabled = await myFlag(); return <div>{enabled ? '功能已开启' : '功能已关闭'}</div>; } -
设置Vercel工具栏(若尚未配置):
- 运行
pnpm i @vercel/toolbar - 用工具栏插件包裹
next.config.ts - 在根布局中渲染完整代码请参考references/nextjs.md — Toolbar Setup。
<VercelToolbar />
- 运行
-
设置Flags Explorer(若尚未配置):创建——请参考下方的Flags Explorer设置章节。
app/.well-known/vercel/flags/route.ts
Vercel Flags
Vercel Flags
Vercel Flags is Vercel's feature flags platform. You create and manage flags from the Vercel dashboard or the CLI, then connect them to your code with the adapter. When you create a flag in Vercel, the and environment variables are configured automatically.
vercel flags@flags-sdk/vercelFLAGSFLAGS_SECRETTo create a flag end-to-end, follow the Agent workflow above.
For the full Vercel provider reference — user targeting, CLI subcommands, custom adapter configuration, and Flags Explorer setup — see references/providers.md.
vercel flagsVercel Flags是Vercel的功能标志平台。你可以通过Vercel控制台或 CLI创建和管理标志,然后通过适配器将其连接到代码中。在Vercel中创建标志时,和环境变量会自动配置。
vercel flags@flags-sdk/vercelFLAGSFLAGS_SECRET要完整创建一个标志,请遵循上述Agent工作流。
关于Vercel提供商的完整参考——用户定位、 CLI子命令、自定义适配器配置和Flags Explorer设置——请查看references/providers.md。
vercel flagsDeclaring flags
声明标志
When using Vercel Flags, declare flags with as shown in the Agent workflow. For other providers, see references/providers.md. Below are the general patterns.
vercelAdapterflag()使用Vercel Flags时,请按照Agent工作流中的示例,通过声明标志。其他提供商的使用方法请查看references/providers.md。以下是通用的模式。
vercelAdapterflag()Basic flag
基础标志
ts
import { flag } from 'flags/next'; // or 'flags/sveltekit'
export const showBanner = flag<boolean>({
key: 'show-banner',
description: 'Show promotional banner',
defaultValue: false,
options: [
{ value: false, label: 'Hide' },
{ value: true, label: 'Show' },
],
decide() { return false; },
});ts
import { flag } from 'flags/next'; // 或 'flags/sveltekit'
export const showBanner = flag<boolean>({
key: 'show-banner',
description: '显示促销横幅',
defaultValue: false,
options: [
{ value: false, label: '隐藏' },
{ value: true, label: '显示' },
],
decide() { return false; },
});Flag with evaluation context
带求值上下文的标志
Use to establish who the request is for. The returned entities are passed to :
identifydecidets
import { dedupe, flag } from 'flags/next';
import type { ReadonlyRequestCookies } from 'flags';
interface Entities {
user?: { id: string };
}
const identify = dedupe(
({ cookies }: { cookies: ReadonlyRequestCookies }): Entities => {
const userId = cookies.get('user-id')?.value;
return { user: userId ? { id: userId } : undefined };
},
);
export const dashboardFlag = flag<boolean, Entities>({
key: 'new-dashboard',
identify,
decide({ entities }) {
if (!entities?.user) return false;
return ['user1', 'user2'].includes(entities.user.id);
},
});使用确定请求对应的用户,返回的实体将传递给:
identifydecidets
import { dedupe, flag } from 'flags/next';
import type { ReadonlyRequestCookies } from 'flags';
interface Entities {
user?: { id: string };
}
const identify = dedupe(
({ cookies }: { cookies: ReadonlyRequestCookies }): Entities => {
const userId = cookies.get('user-id')?.value;
return { user: userId ? { id: userId } : undefined };
},
);
export const dashboardFlag = flag<boolean, Entities>({
key: 'new-dashboard',
identify,
decide({ entities }) {
if (!entities?.user) return false;
return ['user1', 'user2'].includes(entities.user.id);
},
});Flag with another adapter
带其他适配器的标志
Adapters connect flags to third-party providers. Each adapter replaces and :
decideorigints
import { flag } from 'flags/next';
import { statsigAdapter } from '@flags-sdk/statsig';
export const myGate = flag({
key: 'my_gate',
adapter: statsigAdapter.featureGate((gate) => gate.value),
identify,
});See references/providers.md for all supported adapters.
适配器可将标志连接到第三方提供商,每个适配器会替换和方法:
decideorigints
import { flag } from 'flags/next';
import { statsigAdapter } from '@flags-sdk/statsig';
export const myGate = flag({
key: 'my_gate',
adapter: statsigAdapter.featureGate((gate) => gate.value),
identify,
});所有支持的适配器请查看references/providers.md。
Key parameters
关键参数
| Parameter | Type | Description |
|---|---|---|
| | Unique flag identifier |
| | Resolves the flag value |
| | Fallback if |
| | Shown in Flags Explorer |
| | URL to manage the flag in provider dashboard |
| | Possible values, used for precompute + Flags Explorer |
| | Provider adapter implementing |
| | Returns evaluation context (entities) for |
| 参数 | 类型 | 描述 |
|---|---|---|
| | 唯一标志标识符 |
| | 解析标志值的函数 |
| | 当 |
| | 在Flags Explorer中显示的描述 |
| | 提供商控制台中管理该标志的URL |
| | 标志的可选值,用于预计算和Flags Explorer |
| | 实现 |
| | 为 |
Dedupe
Dedupe
Wrap shared functions (especially ) in to run them once per request:
identifydedupets
import { dedupe } from 'flags/next';
const identify = dedupe(({ cookies }) => {
return { user: { id: cookies.get('uid')?.value } };
});Note: is not available in Pages Router.
dedupe将共享函数(尤其是)包裹在中,可确保每个请求仅执行一次:
identifydedupets
import { dedupe } from 'flags/next';
const identify = dedupe(({ cookies }) => {
return { user: { id: cookies.get('uid')?.value } };
});注意:在Pages Router中不可用。
dedupeBulk evaluation
批量求值
To evaluate multiple flags at once, call (from ) instead of awaiting flags one at a time or using . To evaluate a single flag, just call it: .
evaluate()flags/nextPromise.all()await myFlag()ts
import { evaluate } from 'flags/next';
import { flagA, flagB } from '../flags';
// avoid: each await blocks the next, so the flags resolve sequentially
const a = await flagA();
const b = await flagB();
// avoid: parallel, but each flag is evaluated in isolation
const [a, b] = await Promise.all([flagA(), flagB()]);
// prefer: shares work across the batch
const [a, b] = await evaluate([flagA, flagB]);evaluate()Promise.all()evaluate()It accepts either an array (positional results) or an object (keyed results):
ts
const [a, b] = await evaluate([flagA, flagB]);
const { a, b } = await evaluate({ a: flagA, b: flagB });Outside App Router (Pages Router /API routes, or routing middleware), pass the request as the second argument: .
getServerSidePropsawait evaluate([flagA, flagB], request)evaluate()getPrecomputedawait myFlag(code, flagGroup)Adapters can opt into batching by implementing the optional hook. The Vercel adapter () implements it — roughly a 10x reduction in evaluation time when resolving hundreds of flags. See references/providers.md — Custom Adapters for implementing , and references/api.md — for the full signature.
bulkDecide@flags-sdk/vercelbulkDecideevaluate要同时求值多个标志,请调用(来自),而非逐个等待标志或使用。若仅需求值单个标志,直接调用即可:。
evaluate()flags/nextPromise.all()await myFlag()ts
import { evaluate } from 'flags/next';
import { flagA, flagB } from '../flags';
// 不推荐:每个await会阻塞下一个,标志将按顺序解析
const a = await flagA();
const b = await flagB();
// 不推荐:并行执行,但每个标志独立求值
const [a, b] = await Promise.all([flagA(), flagB()]);
// 推荐:在批量操作中共享计算资源
const [a, b] = await evaluate([flagA, flagB]);evaluate()Promise.all()evaluate()它接受数组(按位置返回结果)或对象(按键返回结果)作为参数:
ts
const [a, b] = await evaluate([flagA, flagB]);
const { a, b } = await evaluate({ a: flagA, b: flagB });在App Router之外(Pages Router的/API路由,或路由中间件),需将请求作为第二个参数传入:。
getServerSidePropsawait evaluate([flagA, flagB], request)evaluate()getPrecomputedawait myFlag(code, flagGroup)适配器可通过实现可选的钩子来支持批量求值。Vercel适配器()已实现该钩子——当解析数百个标志时,求值时间可减少约10倍。实现的方法请查看references/providers.md — Custom Adapters,的完整签名请查看references/api.md — 。
bulkDecide@flags-sdk/vercelbulkDecideevaluateevaluateFlags Explorer setup
Flags Explorer设置
Next.js (App Router)
Next.js(App Router)
ts
// app/.well-known/vercel/flags/route.ts
import { createFlagsDiscoveryEndpoint } from 'flags/next';
import { getProviderData } from '@flags-sdk/vercel';
import * as flags from '../../../../flags';
export const GET = createFlagsDiscoveryEndpoint(async () => {
return getProviderData(flags);
});ts
// app/.well-known/vercel/flags/route.ts
import { createFlagsDiscoveryEndpoint } from 'flags/next';
import { getProviderData } from '@flags-sdk/vercel';
import * as flags from '../../../../flags';
export const GET = createFlagsDiscoveryEndpoint(async () => {
return getProviderData(flags);
});With external provider data
结合外部提供商数据
When using a third-party provider alongside Vercel Flags, combine their data with . Each provider adapter exports its own — see the provider-specific examples in references/providers.md.
mergeProviderDatagetProviderData当同时使用第三方提供商和Vercel Flags时,可使用合并它们的数据。每个提供商适配器都会导出自己的——具体示例请查看references/providers.md中的提供商专属内容。
mergeProviderDatagetProviderDataSvelteKit
SvelteKit
ts
// src/hooks.server.ts
import { createHandle } from 'flags/sveltekit';
import { FLAGS_SECRET } from '$env/static/private';
import * as flags from '$lib/flags';
export const handle = createHandle({ secret: FLAGS_SECRET, flags });ts
// src/hooks.server.ts
import { createHandle } from 'flags/sveltekit';
import { FLAGS_SECRET } from '$env/static/private';
import * as flags from '$lib/flags';
export const handle = createHandle({ secret: FLAGS_SECRET, flags });FLAGS_SECRET
FLAGS_SECRET
Required for precompute and Flags Explorer. Must be 32 random bytes, base64-encoded:
sh
node -e "console.log(crypto.randomBytes(32).toString('base64url'))"Use a separate value for each environment (Development, Preview, Production), and mark the Preview and Production values as Sensitive. Run the generator once per environment to produce distinct values, then store each on Vercel:
FLAGS_SECRETsh
vercel env add FLAGS_SECRET production --sensitive --value <production-secret>
vercel env add FLAGS_SECRET preview --sensitive --value <preview-secret>
vercel env add FLAGS_SECRET development --value <development-secret>Then run to sync to local.
vc env pull预计算和Flags Explorer需要该密钥。它必须是32字节的随机字符串,并经过base64编码:
sh
node -e "console.log(crypto.randomBytes(32).toString('base64url'))"为每个环境(开发、预览、生产)使用独立的值,并将预览和生产环境的值标记为敏感数据。为每个环境运行一次生成器以生成不同的值,然后将其存储在Vercel中:
FLAGS_SECRETsh
vercel env add FLAGS_SECRET production --sensitive --value <production-secret>
vercel env add FLAGS_SECRET preview --sensitive --value <preview-secret>
vercel env add FLAGS_SECRET development --value <development-secret>然后运行同步到本地。
vc env pullPrecompute pattern
预计算模式
Use precompute to keep pages static while using feature flags. Middleware evaluates flags and encodes results into the URL via rewrite. The page reads precomputed values instead of re-evaluating.
High-level flow:
- Declare flags and group them in an array
- Call in middleware, get a
precompute(flagGroup)stringcode - Rewrite request to
/${code}/original-path - Page reads flag values from :
codeawait myFlag(code, flagGroup)
For full implementation details, see framework-specific references:
- Next.js: See references/nextjs.md — covers proxy middleware, precompute setup, ISR, generatePermutations, multiple groups
- SvelteKit: See references/sveltekit.md — covers reroute hook, middleware, precompute setup, ISR, prerendering
使用预计算模式可在使用功能标志的同时保持页面静态化。中间件会求值标志并将结果编码到URL中,通过重定向实现。页面将读取预计算值,而非重新求值。
大致流程:
- 声明标志并将其分组为数组
- 在中间件中调用,获取
precompute(flagGroup)字符串code - 将请求重定向到
/${code}/original-path - 页面从中读取标志值:
codeawait myFlag(code, flagGroup)
完整实现细节请查看框架专属参考:
- Next.js:查看references/nextjs.md——涵盖代理中间件、预计算设置、ISR、generatePermutations、多组标志等内容
- SvelteKit:查看references/sveltekit.md——涵盖重定向钩子、中间件、预计算设置、ISR、预渲染等内容
Custom adapters
自定义适配器
Create an adapter factory that returns an object with and . For the full pattern (including default adapter and singleton client examples), see references/providers.md.
origindecide创建一个适配器工厂,返回包含和方法的对象。完整模式(包括默认适配器和单例客户端示例)请查看references/providers.md。
origindecideEncryption functions
加密函数
For keeping flag data confidential in the browser (used by Flags Explorer):
| Function | Purpose |
|---|---|
| Encrypt resolved flag values |
| Decrypt flag values |
| Encrypt flag definitions/metadata |
| Decrypt flag definitions |
| Encrypt toolbar overrides |
| Decrypt toolbar overrides |
All use by default. Example:
FLAGS_SECRETtsx
import { encryptFlagValues } from 'flags';
import { FlagValues } from 'flags/react';
async function ConfidentialFlags({ values }) {
const encrypted = await encryptFlagValues(values);
return <FlagValues values={encrypted} />;
}用于在浏览器中保护标志数据的机密性(Flags Explorer使用):
| 函数名称 | 用途 |
|---|---|
| 加密已解析的标志值 |
| 解密标志值 |
| 加密标志定义/元数据 |
| 解密标志定义 |
| 加密工具栏覆盖配置 |
| 解密工具栏覆盖配置 |
所有函数默认使用作为密钥。示例:
FLAGS_SECRETtsx
import { encryptFlagValues } from 'flags';
import { FlagValues } from 'flags/react';
async function ConfidentialFlags({ values }) {
const encrypted = await encryptFlagValues(values);
return <FlagValues values={encrypted} />;
}React components
React组件
tsx
import { FlagValues, FlagDefinitions } from 'flags/react';
// Renders script tag with flag values for Flags Explorer
<FlagValues values={{ myFlag: true }} />
// Renders script tag with flag definitions for Flags Explorer
<FlagDefinitions definitions={{ myFlag: { options: [...], description: '...' } }} />tsx
import { FlagValues, FlagDefinitions } from 'flags/react';
// 渲染包含标志值的脚本标签,供Flags Explorer使用
<FlagValues values={{ myFlag: true }} />
// 渲染包含标志定义的脚本标签,供Flags Explorer使用
<FlagDefinitions definitions={{ myFlag: { options: [...], description: '...' } }} />References
参考文档
Detailed framework and provider guides are in separate files to keep context lean:
- references/nextjs.md: Next.js quickstart, toolbar, App Router, Pages Router, middleware/proxy, precompute, dedupe, dashboard pages, marketing pages, suspense fallbacks
- references/sveltekit.md: SvelteKit quickstart, toolbar, hooks setup, precompute with reroute + middleware, dashboard pages, marketing pages
- references/providers.md: All provider adapters — Vercel, Global Config, Statsig, LaunchDarkly, PostHog, GrowthBook, Hypertune, Flagsmith, Reflag, Split, Optimizely, OpenFeature, and custom adapters
- references/api.md: Full API reference for ,
flags,flags/react, andflags/nextflags/sveltekit
详细的框架和提供商指南位于单独的文件中,以保持内容简洁:
- references/nextjs.md:Next.js快速入门、工具栏、App Router、Pages Router、中间件/代理、预计算、dedupe、仪表盘页面、营销页面、Suspense回退等内容
- references/sveltekit.md:SvelteKit快速入门、工具栏、钩子设置、结合重定向+中间件的预计算、仪表盘页面、营销页面等内容
- references/providers.md:所有提供商适配器——Vercel、全局配置、Statsig、LaunchDarkly、PostHog、GrowthBook、Hypertune、Flagsmith、Reflag、Split、Optimizely、OpenFeature及自定义适配器
- references/api.md:、
flags、flags/react和flags/next的完整API参考flags/sveltekit