Commit Graph

64 Commits

Author SHA1 Message Date
Dominik Ferber 2532e99ea8 chore: fix open Dependabot security alerts (#470)
Bumps the vulnerable transitive dependencies flagged by Dependabot via
pnpm overrides, and the direct nanoid dependency in the examples.

- nanoid >= 4 -> ^5.1.16 (GHSA infinite loop on negative/zero size)
- brace-expansion >= 4 -> ^5.0.9 (DoS via unbounded intermediate arrays)
- dompurify -> ^3.4.13 (XSS via detached subtree after IN_PLACE hook removal)
- fast-uri -> ^3.1.5 (host confusion via backslash authority introducer)
- js-yaml 3 -> ^3.15.1, js-yaml 4 -> ^4.3.1 (quadratic CPU in !!omap)
- mermaid -> ^11.16.1 (DoS, prototype pollution, CSS injection)
- postcss -> ^8.5.23 (arbitrary .map file read via sourceMappingURL)
- @sveltejs/kit -> ^2.70.2 (ReDoS in Accept header content negotiation)

image-size (alerts #979, #980) has no patched release yet, so it is left
as-is. It is only used at build time by the docs site.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-11 20:14:54 +02:00
Andy 8913cf1578 Bump @vercel/global-config to 1.5.1 (#464)
* Bump Global Config SDK

* Add changeset
2026-08-07 16:00:05 +02:00
Luis Meyer 58e1f5bcdf Rename Edge Config packages to Global Config (#452)
* Rename edge config packages

* Rename Global Config APIs

* Fix Global Config environment setup

* Rename Global Config endpoints

* Update Global Config documentation links

* Undo lockfile changes

* Update lockfile

* Undo lockfile changes

* Update lockfile

* Fall back to EDGE_CONFIG

---------

Co-authored-by: Andy Bitz <artzbitz@gmail.com>
2026-08-04 12:36:41 +02:00
Dominik Ferber fde6ab7135 address CodeQL alerts (#448)
* explicit workflow permissions

* max-delay

* better parsing
2026-07-26 10:20:17 -04:00
Dominik Ferber 6dbf589e0c upgrade toolbar and others (#447) 2026-07-26 13:42:26 +00:00
Dominik Ferber 42cc02cacd upgrade more packages (#446) 2026-07-26 13:20:24 +00:00
Dominik Ferber 1f000784e5 upgrade vite & vitest (#445) 2026-07-26 08:25:37 -04:00
Dominik Ferber 0cf1f2b201 upgrade next and postcss (#444)
* upgrade postcss

* [snippets] upgrade postcss

* upgrade next

* upgrade postcss

* upgrade pnpm-lock
2026-07-26 07:35:48 -04:00
Dominik Ferber c0d8224015 docs: use adapter factory shorthand (adapter: vercelAdapter) (#409)
Update docs and examples to pass the adapter factory directly
(adapter: vercelAdapter) instead of calling it (adapter: vercelAdapter()),
reflecting the AdapterOrFactory support in flag(). Applied consistently to
all zero-arg factory adapters (vercel, edge-config, custom adapter examples).

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-25 12:22:47 +02:00
Dominik Ferber df427e0e7a use catalog for react & react-dom (#318)
* use catalog for react & react-dom

this guarantees the same version for all packages and thus avoids type errors

* update lockfile
2026-03-09 19:01:30 +02:00
Dominik Ferber 2db1530275 Upgrade dependencies (#313)
* upgrade

* update biome

* upgrade more
2026-03-09 12:24:42 +00:00
Dominik Ferber 53149f5e81 add client (#255)
* prepare

* origin

* prepare script

* step

* redo peer deps

* wip

* continue

* every 5 secs

* connect flag network

* add shirt-shop-vercel

* upgrade

* push

* update endpoint

* add vercel getProviderData

* fix importts

* Add retries to flag network datasource (#237)

* Fix React Server Components CVE vulnerabilities (#235)

Updated dependencies to fix Next.js and React CVE vulnerabilities.

The fix-react2shell-next tool automatically updated the following packages to their secure versions:
- next
- react-server-dom-webpack
- react-server-dom-parcel  
- react-server-dom-turbopack

All package.json files have been scanned and vulnerable versions have been patched to the correct fixed versions based on the official React advisory.

Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>

* Add retries to flag network datasource when stream closes

Implements automatic retry logic with exponential backoff when the flag network
stream unexpectedly closes. The stream will retry with delays increasing from
1s to a maximum of 30s, allowing the datasource to recover from temporary
network issues while falling back to bundled definitions if initial connection
fails.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

* Revert package.json and pnpm-lock changes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>

* use ndjson (#238)

* try

* try

* use debugLog

* replace testkey

* never retry on 4xx

* Track FLAG_CONFIG_READ events

* update @biomejs/biome

* send user-agent, rm terminate handling, fix tests

* extract usage-tracker and add tests

* rm EdgeConfigDataSource

* export EvaluationParams and EvaluationResult

* drop edge-config dep

* drop edge config from @flags-sdk/vercel

* adapt @flags-sdk/vercel

* fix integration tests

* wip

* assert ingest requests

* race initial connection, retry in background, abort on shutdown

* rm store

* make readBundledDefinitions async

* read from @vercel/flags-definitions/definitions.json

* add ensureFallback fn

* getDefaultFlagsClient() → flagsClient

* rm process.pid

* rm webpackIgnore: true

* require fallbacks at build time on vercel only

* test in layout

* vercel-flags prepare --verbose

* rm prebuild script

* ensure fallback from instrumentation.ts

* rm last process.pid

* print warning

* Track duration and cache status for config reads

* add tests

* await stream in initialize method

* consumeStream → runStreamLoop

* replace subscribe with doInitialize

* add webpackIgnore

* make @vercel/flags-core a peer dep

* fresh start

* debug

* step

* next-connection

* avoid opening stream during builds

* undo next specific exports

* handle abort

* fake

* poc

* clean up imports

* next-js exports

* upgrade next

* move "use cache" up

* move "use cache" handling to client

* split index.default.ts and index.next-js.ts

* separate

* jsdoc

* use scoped map instead of passing ref

* move jsdoc

* rename

* keep dataSource private, clean clientMap

* reset retryCount on connection; abort on 401

* break after 10 retries

* add backoff with jitter + limit

* add usage tracking and read fallback

* refactor

* extract stream-connection, update tests

* add tests

* reduce test amount

* add perf metadata

* add BaseEvaluationResult

* getData → read

* rm shirt-shop-vercel

* drop next-connection

* update pnpm-lock

* getMetadata → getInfo

* add getDatafile

* DataSourceData → Datafile

* merge metrics into datafile

* simplify metrics

* use embed for getDatafile

* add comment

* comment

* bring shirt-shop-vercel back

* try setCacheLife

* support cache components in OpenFeature import

* use new format

* rm cli

* fix origin

* use bundler

* simplify

* ensure warning is highlighted in build logs

* warn only once

* ensureFallback → getFallbackDatafile

* improve perf

* avoid creating new objects

* fix type issues

* stop exposing createRawClient

* fix: mark stream reconnection loop as intentional fire-and-forget

Add void operator before async IIFE to explicitly indicate the floating
promise is intentional, preventing linter warnings and making the code
intent clearer to future maintainers.

* fix: handle malformed JSON in stream messages gracefully

Wrap JSON.parse in try/catch to prevent crashes from malformed server
responses. Logs a warning and skips the invalid message instead of
crashing the stream connection handler.

* fix: add bounds checking for variant index access

Add getVariant() helper that throws a descriptive error if the variant
index is out of bounds. This prevents silent undefined returns when
variant indices are invalid, making issues easier to debug in production.

* fix: prevent concurrent initialization race condition

Add initializingPromise to coordinate concurrent initialize() calls.
The fast boolean check is preserved for the hot path, while concurrent
calls during initialization now await the same promise instead of
triggering multiple initializations.

* fix: add timeout and retry logic to fetchDatafile

- Add 10-second timeout using AbortController to prevent indefinite hangs
- Add exponential backoff retry (up to 3 attempts) for transient failures
- Skip retries for 4xx client errors (except 429 rate limiting)
- Improves resilience against network issues in production

* fix: prevent race condition in ensureStream

Use local variable for abortController and store streamPromise
immediately after creation. This prevents concurrent calls from
creating multiple streams or overwriting the abort controller
before the promise is stored.

* fix: prevent race condition in read() by capturing data reference

Capture this.data reference at the start of read() to ensure consistent
state throughout the method. The onMessage callback from the stream can
update this.data during async operations, which could cause inconsistent
behavior if the reference changes mid-operation.

* comments

* add streaming connectionState

* update usage

* fix init

* try to avoid hanging promise

* update attw, add types

* get rid of unnecessary async/await

* avoid printing the warning

* distinct warnings

* don't export cachedFns

* add CLAUDE.md

* jsdoc

* clear timeout

* export Datafile

* avoid exposing data sources

* simplify

* types

* avoid dangling timeout

* more options

* tests

* allow options in createClient

* DatafileInput

* better options

* Update event tracking to use streams

* Revert "Update event tracking to use streams"

This reverts commit cff740a18c.

* fix datafile input type

* type

* handle shutdown and re-init

* defensive

* retry stream for up to 15 minutes

* Update event reporting to use ndjson for more events

* Revert "Update event reporting to use ndjson for more events"

This reverts commit f70a7bfc59.

* Add debug logs to the usage tracker

* [adapter-vercel] fix getProviderData

* [adapter-vercel] only return vercel flags from getProviderData

* fix

* rm getInfo

* rm tgz

* rm example

* rm next/connection from gitignore

* rm unused deps

* use DatafileInput type

* fix tests

* ensure pollCount > 0

* fix type issues

* fix retry logic

* upgrade @sveltejs/kit

* resolve ci issues

---------

Co-authored-by: Luis Meyer <luis.meyer@vercel.com>
Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
Co-authored-by: Andy Bitz <artzbitz@gmail.com>
2026-02-09 11:45:00 +02:00
dependabot[bot] 4003a93198 Bump @sveltejs/kit from 2.47.3 to 2.49.5 (#250)
* Bump @sveltejs/kit from 2.47.3 to 2.49.5

Bumps [@sveltejs/kit](https://github.com/sveltejs/kit/tree/HEAD/packages/kit) from 2.47.3 to 2.49.5.
- [Release notes](https://github.com/sveltejs/kit/releases)
- [Changelog](https://github.com/sveltejs/kit/blob/main/packages/kit/CHANGELOG.md)
- [Commits](https://github.com/sveltejs/kit/commits/@sveltejs/kit@2.49.5/packages/kit)

---
updated-dependencies:
- dependency-name: "@sveltejs/kit"
  dependency-version: 2.49.5
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>

* Trigger CI

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Vincent Derks <vincent.derks@vercel.com>
2026-02-06 10:37:34 +01:00
dependabot[bot] 1d59ce11de Bump next from 16.0.10 to 16.1.5 in /packages/flags (#247)
* Bump next from 16.0.10 to 16.1.5 in /packages/flags

Bumps [next](https://github.com/vercel/next.js) from 16.0.10 to 16.1.5.
- [Release notes](https://github.com/vercel/next.js/releases)
- [Changelog](https://github.com/vercel/next.js/blob/canary/release.js)
- [Commits](https://github.com/vercel/next.js/compare/v16.0.10...v16.1.5)

---
updated-dependencies:
- dependency-name: next
  dependency-version: 16.1.5
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>

* Updated lockfile

* Bump to 16.1.5 in other packages

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Vincent Derks <vincent.derks@vercel.com>
2026-02-06 10:07:56 +01:00
vercel[bot] 23cf50428e Fix React Server Components CVE vulnerabilities (#235)
Updated dependencies to fix Next.js and React CVE vulnerabilities.

The fix-react2shell-next tool automatically updated the following packages to their secure versions:
- next
- react-server-dom-webpack
- react-server-dom-parcel  
- react-server-dom-turbopack

All package.json files have been scanned and vulnerable versions have been patched to the correct fixed versions based on the official React advisory.

Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
2025-12-12 07:20:30 +02:00
Dominik Ferber ec0d13f66f Rename Edge Middleware to Routing Middleware / Proxy (#229)
* adjust proxy export

* rename Edge Middleware to Proxy

* mv folder

* rename featureFlagsInProxy

* proxy

* Routing Functions → Routing Middleware
2025-12-05 11:51:42 +02:00
Dominik Ferber f1376294aa upgrade (#226)
* upgrade

* use as-any workaround
2025-12-04 14:27:54 +02:00
Dominik Ferber ff052f0417 upgrade to @vercel/edge-config dependency (#199)
* upgrade to @vercel/edge-config dep

* update lockfile
2025-10-25 12:00:06 +03:00
Dominik Ferber ba4eec7b23 replace eslint and prettier with biome (#187)
* remove @pyra/eslint-config

* wip

* wip

* convert shirt-shop-api

* convert shirt-shop

* convert snippets

* convert next-13

* convert next-14

* convert next-15

* eslint configs

* upgrade prettier

* use eslint v9

* run prettier

* resolve type-check

* adjust eslint

* drop Next.js v13

* fix next-14

Avoid accidentally using implicitly installed eslint v8

* update lockfile

* rm @eslint/eslintrc

* add @next/eslint-plugin-next

* biome

* biome fixes

* wip

* apply formatting

* tabs

* rm prettier

* spaces

* fix svelte

* update lockfile

* single quotes

* format all

* rm eslint-disable comments

* upgrade playwright

* upgrade publint

* upgrade playwright ci workflow

* try chromium headless

* try adding executablePath
2025-10-15 23:38:17 +03:00
Dominik Ferber e1def0eb34 upgrade @flags-sdk/launchdarkly (#169)
* upgrade @flags-sdk/launchdarkly

* remove unused dependencies
2025-09-11 18:54:03 +03:00
Daniel Roe f54cc0cd9f chore: add test .env files (#160)
* chore: add test `.env` files

* add EDGE_CONFIG env var

Adds the EDGE_CONFIG env var to the snippets example with a read-only token meant for public consumption.

---------

Co-authored-by: Dominik Ferber <dominik.ferber@gmail.com>
2025-09-09 13:46:00 +03:00
Dominik Ferber 79b25f6aee @flags-sdk/bucket adapter (#96)
* init
* [@flags-sdk/bucket] getProviderData (#113)
* [@flags-sdk/bucket] various improvements (#121)
* Update framer-motion to motion for CI

---------

Co-authored-by: Ron Cohen <cohen1@gmail.com>
Co-authored-by: Aaron Morris <aaron@vercel.com>
2025-05-16 17:05:38 -04:00
Dominik Ferber bc7944ed89 split crypto functions into dedicated functions (#126) 2025-05-02 17:45:00 +03:00
Dominik Ferber 3994336c4d style examples (#111) 2025-03-21 17:48:34 +02:00
Simon H 701f3c2bf2 Sveltekit flags enhancements (#75)
* use `$env/dynamic/private` from SvelteKit for convenience: people don't have to pass FLAGS_SECRET manually anymore then

* allow flag to be called outside of the lifecycle of the handle hook, with a request object being the key for deduplication etc

* add support for identifiers

* fix types

* new function for managing precomputed flags

* align with next.js API instead

* update example app

* lockfile

* test

* fix example

* restructure examples app

* make it two flags to show power of precompute + code

* add manual approach

* lets see if preview deployment is picked up

* change crypto usage to be usable in middleware

* make sveltekit flags pkg usable within edge middleware

* use ISR

* changeset

* enhance error message

* use static env instead of dynamic env

* bump kit

* use vercel adapter

* make sure Vite tooling is used for sveltekit entry point

---------

Co-authored-by: Dominik Ferber <dominik.ferber@gmail.com>
2025-03-21 14:43:28 +02:00
Andy 2fcc446ea8 Create LaunchDarkly adapter (#2)
* Create LaunchDarkly adapter

* Update example to include a LaunchDarkly flag

* Add missing env to turbo

* Rename to defaultLaunchDarklyAdapter

* Add winter sale example for providers

* Update winter-sale

* Document usage in readme

* Allow to set the default value through the adapter

* Fix readme

* Add default value for adapter

* Make argument optional

* Add @ts-expect-error

* Add a LaunchDarkly adapter (#10)

* add ld example

* reword

* remove winter-sale example

* remove defaultValue

* use @flags-sdk/launchdarkly

* add install steps

* add changeset

* move @vercel/edge-config to peer deps

* add more secrets

* spell out name

* remove unused env var

* rename properties

* Capitalize

* Change import

* Fix more imports

* expose ldClient

* move peerDeps to real deps

* clarify Edge Config requirement in README

* remove adapter-launchdarkly snippet

* upgrade next@canary

* polish @flags-sdk/launchdarkly README

---------

Co-authored-by: Dominik Ferber <dominik.ferber@gmail.com>
2025-03-08 09:29:26 +02:00
Dominik Ferber a5bfb13c43 extended example (#84)
* wip

* adapt nav

* store management

* ssr cart

* clean up

* fix stableId issue

* allow image sorting

* toast on ProceedToCheckoutButton

* move actions, extract components

* Add PPR to Cart (#85)

* toast on Shop now

* allow delay

* loading spinner

* wip

* fix animations

* show cart count

* Extend shirt-shop demo with dynamic flag usage (#86)

* better metadata

* wip

* move cart to api

* wip

* respect free shipping

* add example banner

* init shadcn

* reorg

* remove relative paths from components

* do not link footer

* wip

* remove shadcn setup

* api-server » shirt-shop-api

* /api/:cartId » /api/cart/:cartId

* add delayFlag desc

* fix cart count

* remove quantity

* fine tune animation

* shrink

* list envs, fix Link

* change flag names

* set cart-id from middleware

* append headers

* allow cloning

* add BACKEND_URL fallback
2025-03-04 17:05:13 +01:00
Dominik Ferber e398e7752f remove duplicate package.json 2025-02-28 14:58:12 +02:00
Dominik Ferber 4ad02b9e6f add comments 2025-02-28 13:08:43 +02:00
Dominik Ferber 372b5bb807 use scripts/install 2025-02-28 13:00:38 +02:00
Dominik Ferber 44b8c099fe npm 2025-02-28 12:54:50 +02:00
Dominik Ferber 15bb48a002 compat 2025-02-28 12:52:20 +02:00
Dominik Ferber 1e6e3a816d log 2025-02-28 12:29:53 +02:00
Dominik Ferber d3646d712a clean up 2025-02-28 12:20:31 +02:00
Dominik Ferber 09f6c95f68 run pnpm script to replace workspace dependencies when cloning example (#82)
* use npm when cloning

* use pnpm

* rewrite
2025-02-28 12:18:24 +02:00
Dominik Ferber 8a3ccdb678 allow using shirt-shop as a template (#80)
* allow using shirt-shop as a template

* js » mjs
2025-02-28 11:47:30 +02:00
Dominik Ferber 646778643e convert summer-sale to shirt-shop (#79)
* convert summer-sale to shirt-shop

* update deps

* canary for snippets

* expect errors

* upgrade deps

* ComponentRef

* steps
2025-02-28 11:04:12 +02:00
Dominik Ferber 422435c0eb rename (#68)
* @vercel-flags » flags

* update lockfile

* fix name
2025-02-20 19:54:09 +02:00
Dominik Ferber 48cbe4533b Add @flags-sdk/edge-config adapter (#57)
* add Edge Config Adapter
* add README and tests
* add changeset
* add edge config caching

---------

Co-authored-by: Aaron Morris <aaron@vercel.com>
2025-02-14 10:53:13 -05:00
Dominik Ferber 2388982f2f bring dark mode back for snippets (#55)
* Revert "Revert "add dark mode support (#53)" (#54)"

This reverts commit 2161f4d5f1.

* switch to cssVariables: false

* bring back darkmode for DemoFlag

* fix suspense example

* fix skeleton example
2025-02-01 12:30:03 +02:00
Dominik Ferber 2161f4d5f1 Revert "add dark mode support (#53)" (#54)
This reverts commit 77d68a4a96.
2025-02-01 06:27:57 +02:00
Dominik Ferber 77d68a4a96 add dark mode support (#53) 2025-01-31 08:47:25 -05:00
Dominik Ferber 2713ea7aff throw on undefined unless defaultValue is defined (#46)
* throw when decide returns undefined

* throw on undefined unless defaultValue is defined

* wip

* bring back JsonValue

* do not enforce on typescript level for now

* add changeset

* mention exported types

* add precise types

* fix summer-sale example
2025-01-24 14:22:12 +02:00
Dominik Ferber 55fe9b5e3c change from .com to .dev (#38) 2025-01-17 13:32:02 +02:00
Dominik Ferber f8d5236477 fix csp (#37) 2025-01-16 20:09:16 +02:00
Dominik Ferber 5351cd8259 change domain (#29) 2025-01-16 12:36:02 +01:00
Dominik Ferber bb19b95355 adapt example (#26) 2025-01-14 17:23:12 +01:00
Dominik Ferber 3c56919727 replace favicon (#21) 2025-01-13 14:21:18 +01:00
Dominik Ferber 8043be4059 add favicon to snippets (#20) 2025-01-13 15:17:49 +02:00
Dominik Ferber f44f3971f5 make overview example dynamic (#18) 2025-01-13 09:31:51 +01:00