Repository navigation
flags@5.0.0-standard.0
Pre-releaseMajor Changes
-
#639
81b4fdfThanks @dferber90! - The Flags SDK is framework-neutral.flag(),evaluate(),dedupe(),clearDedupeCacheForCurrentRequest(),precompute(),generatePermutations()andgetPrecomputed()come fromflags.flags/nextandflags/sveltekitare removed.A framework gives the SDK the current request through its build plugin, which points the alias
flags/frameworkto the binding of the framework:- Next.js:
withFlagsof@flags-sdk/next/plugininnext.config.ts. Only Turbopack is supported, and Next.js 16 is the minimum. - SvelteKit:
flags()of@flags-sdk/sveltekit/viteinvite.config.ts. The binding reads the request withgetRequestEvent()of$app/server, so SvelteKit 2.20 is the minimum, andcreateHandleis optional.
Without a plugin, pass the request as before, e.g.
flag(request)in the Pages Router orprecompute(flags, request);precompute()now takes an optional request.The rules of
flags/nextapply to all frameworks. For SvelteKit, this changes: a flag returns itsdefaultValuewhendecidethrows or returnsundefined, the cache of a request is per flag and entities,identifyruns for each evaluation,reportValue: falseis respected, andevaluate()supportsbulkDecideof adapters.New for framework packages: the types
FrameworkBindingandFrameworkRequest, andgetEvaluatedFlagValues(request?), the values which a request evaluated.Without a secret argument, the helpers
encryptFlagValues,decryptFlagValues,encryptOverrides,decryptOverrides,encryptFlagDefinitions,decryptFlagDefinitions,createAccessProof,verifyAccessProofandverifyAccessreadFLAGS_SECRETalso from the environment of the framework, e.g.$envof SvelteKit duringvite dev. - Next.js: