Documentation
¶
Index ¶
- Variables
- func GetBuildID(host string) string
- func HasNextJSMarkers(body string) bool
- func IsClientBuildArtifact(path string) bool
- func IsNextJS(host string) bool
- func LooksLikeNextJS(host, body string) bool
- func LooksLikeServerSideJS(host, xPoweredBy, server, body string) bool
- func Set(host string, fp *HostFingerprint)
- type FrameworkType
- type HostFingerprint
Constants ¶
This section is empty.
Variables ¶
var BuildIDRegex = regexp.MustCompile(`"buildId"\s*:\s*"([^"]+)"`)
BuildIDRegex extracts the buildId from __NEXT_DATA__ JSON.
var UseClientDirectiveRe = regexp.MustCompile(`(?:'use client'|"use client")`)
UseClientDirectiveRe matches the "use client" directive in JS/TS source.
Functions ¶
func GetBuildID ¶
GetBuildID returns the build ID for a host, or "" if not available.
func HasNextJSMarkers ¶
HasNextJSMarkers returns true if the body contains Next.js markers.
func IsClientBuildArtifact ¶
IsClientBuildArtifact reports whether a path is under a JS framework's immutable client build-output directory (Next.js `/_next/static/`, Nuxt `/_nuxt/`). Server-only data-fetching / caching / server-action code is compiled OUT of these bundles by the bundler, so a passive detector that greps a served chunk for server-side constructs only finds framework-machinery strings — the same bundle hash appears across every site using that framework, producing one false positive per host. Source-analysis detectors should skip these paths. NOTE: server_only_boundary_audit is the deliberate exception — it scans exactly these paths to catch server code that leaked into the client bundle — so it must NOT call this.
func LooksLikeNextJS ¶
LooksLikeNextJS returns true if the host is fingerprinted as Next.js, or the body contains Next.js markers as a fallback.
func LooksLikeServerSideJS ¶
LooksLikeServerSideJS reports whether the response signals — the X-Powered-By and Server header values and the response body — indicate a server-side JavaScript runtime (Node.js and its frameworks), or the host is fingerprinted as Next.js. It is the shared tech-stack gate for Node-targeting active modules.
Types ¶
type FrameworkType ¶
type FrameworkType string
FrameworkType identifies a JavaScript framework.
const ( NextJS FrameworkType = "nextjs" NuxtJS FrameworkType = "nuxtjs" Angular FrameworkType = "angular" ReactCRA FrameworkType = "react-cra" Remix FrameworkType = "remix" SvelteKit FrameworkType = "sveltekit" Gatsby FrameworkType = "gatsby" Unknown FrameworkType = "" )
type HostFingerprint ¶
type HostFingerprint struct {
Framework FrameworkType
BuildID string
AppRouter bool // Next.js App Router vs Pages Router
ExtraData map[string]string
}
HostFingerprint stores detected framework metadata for a given host.
func Get ¶
func Get(host string) *HostFingerprint
Get returns the cached fingerprint for a host, or nil if not found.