jsframework

package
v0.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BuildIDRegex = regexp.MustCompile(`"buildId"\s*:\s*"([^"]+)"`)

BuildIDRegex extracts the buildId from __NEXT_DATA__ JSON.

View Source
var UseClientDirectiveRe = regexp.MustCompile(`(?:'use client'|"use client")`)

UseClientDirectiveRe matches the "use client" directive in JS/TS source.

Functions

func GetBuildID

func GetBuildID(host string) string

GetBuildID returns the build ID for a host, or "" if not available.

func HasNextJSMarkers

func HasNextJSMarkers(body string) bool

HasNextJSMarkers returns true if the body contains Next.js markers.

func IsClientBuildArtifact

func IsClientBuildArtifact(path string) bool

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 IsNextJS

func IsNextJS(host string) bool

IsNextJS returns true if the host has been fingerprinted as Next.js.

func LooksLikeNextJS

func LooksLikeNextJS(host, body string) bool

LooksLikeNextJS returns true if the host is fingerprinted as Next.js, or the body contains Next.js markers as a fallback.

func LooksLikeServerSideJS

func LooksLikeServerSideJS(host, xPoweredBy, server, body string) bool

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.

func Set

func Set(host string, fp *HostFingerprint)

Set stores a fingerprint for a host.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL