Repository navigation
feat(security-kit): work with every library (0.2.0) - #2
Merged
Merged
Conversation
Collector subscribe/getSnapshot; browser adapters for fetch, axios, ky, Apollo and stores; optional React hook; server adapters for Express, Fastify and Fetch-standard servers. No adapter imports its library. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L5Py9guKQFcFPmdme7bRjo
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.
Requested by Himanshu · project thread
What and why
Before: the collector gave you headers to add by hand, and the server helpers had to be wired into each framework yourself.
After: the kit drops into any client or server without forcing a library.
subscribe/getSnapshot, so any reactive library can follow the signals (React, Vue, Svelte, Solid, Angular, RxJS)./browseradapters:signalFetch(any library that takes a custom fetch: our client, graphql-request, urql, Apollo HttpLink, TanStack Query functions),axiosSignals,kySignals,apolloSignals,mergeSignalHeaders,signalStore(Svelte store contract)./react:useDeviceSignals(collector), the one optional peer (react >= 18), built with a"use client"banner./serveradapters:fastifySecurity(plugin,request.security),expressSecurity(middleware,req.security),fetchSecurity(Hono, Next.js, Bun, Deno, Yoga),requestSecurity(any framework or a GraphQL context). Each sets the security headers, optional CORS with preflight, and reads the IP and validated signals.How: no adapter imports its library; each matches the library's hook shape. The README has a table of how to plug into each library.
npm test(44 checks) runs the Express and Fastify adapters on real apps and renders the React hook.Type
Checklist
main)npm run typecheckpasses (shared, browser and react compile without Node.js types)npm test(44),npm run buildandscripts/check-dist.mjspass🤖 Generated with Claude Code
https://claude.ai/code/session_01L5Py9guKQFcFPmdme7bRjo
Generated by Claude Code