Repository navigation
Conversation
A module which starts with 'use flags' exports only flags. flags/manifest creates the manifest of the flags from the exports of these modules, and flags/tooling has the functions for build plugins: the check of the directive, the scan of the project, and the writer of flags-manifest.json after a build. Co-Authored-By: Claude <noreply@anthropic.com>
The route @flags-sdk/next/manifest returns the manifest in next dev. A loader of withFlags puts the imports of the modules with 'use flags' into it. next build writes the manifest into .next/flags-manifest.json. The types of withFlags accept a next version other than the one of this package. Co-Authored-By: Claude <noreply@anthropic.com>
flags() serves the manifest at /.well-known/flags/manifest.json in vite dev, and writes it into the server output after vite build. Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The next iteration of v5 on
standard, ported fromstandard-north-star: the'use flags'directive and the manifest of the flags.What it does
'use flags': a module which starts with this directive exports only flags. Other exports make the manifest fail with a clear error.flags/manifest:createManifest(modules)andvalidateFlagsManifest. The manifest uses the format of north-star (version: 1,sources,definitionssorted by key,declaredInCode,declarations). It reads only the exports and evaluates no flag.flags/tooling:hasUseFlagsDirective,findFlagsModules(a scan of the project) andwriteManifestFromBuild(imports the built chunks in a child process).@flags-sdk/next:app/.well-known/flags/manifest.json/route.tswithexport { GET } from '@flags-sdk/next/manifest'.withFlagsputs the imports of all flags modules into the route. It adds the project as a context dependency, so a new flags module shows up innext devwithout a restart.next buildwrites.next/flags-manifest.jsoninrunAfterProductionCompile. In production, the route returns 404.@flags-sdk/sveltekit:flags()serves/.well-known/flags/manifest.jsoninvite dev..svelte-kit/output/server/flags-manifest.json: each flags module becomes its own chunk, and a child process imports the chunks.Changes from north-star
flag()have notype. The manifest takes it fromdefaultValue, or fromoptionswhen all options have the same type. Otherwise the flag has notype, sotypeis optional in this format.sourcesis always{}.flags manifestCLI.@flags-sdk/vitepackage: the SvelteKit plugin does it itself.withFlagsis typed withT extends object, like on north-star. Before,next.config.tsoftests/next-16failed the type check ofnext buildbecause there are two copies ofnextin the store. This already failed onstandard.Tests
flags306,@flags-sdk/next25,@flags-sdk/sveltekit15. Types andattwpass.tests/next-16:next buildwrites the manifest, andnext startreturns 404 for the route. In dev, a flags module that is added or removed shows up in, or goes away from, the manifest.precomputedFlagsmoved toprecomputed-flags.ts, becauseflags.tsxnow has'use flags'.tests/sveltekit-e2e: a new spec for the dev manifest passes.vite buildwrites the file.precomputed/page.spec.ts"client-side navigation, new visitor" fails, but it also fails 3 of 3 times onstandardwithout this PR. It passes on some runs with a warm Vite cache.flags@5.0.0-standard.1,@flags-sdk/next@0.1.0-standard.1,@flags-sdk/sveltekit@0.1.0-standard.1.🤖 Generated with Claude Code