Documentation
¶
Overview ¶
Package framework provides modular SPA framework detection and handling.
Index ¶
- type AngularHandler
- func (h *AngularHandler) Detect(page *rod.Page) bool
- func (h *AngularHandler) ExtractLinks(page *rod.Page) ([]Link, error)
- func (h *AngularHandler) ExtractRoutes(page *rod.Page) ([]Route, error)
- func (h *AngularHandler) GetRouteChangeScript() string
- func (h *AngularHandler) NavigateToRoute(page *rod.Page, route string) error
- func (h *AngularHandler) Type() Type
- func (h *AngularHandler) WaitForReady(page *rod.Page) error
- type AngularJSHandler
- func (h *AngularJSHandler) Detect(page *rod.Page) bool
- func (h *AngularJSHandler) ExtractLinks(page *rod.Page) ([]Link, error)
- func (h *AngularJSHandler) ExtractRoutes(page *rod.Page) ([]Route, error)
- func (h *AngularJSHandler) GetRouteChangeScript() string
- func (h *AngularJSHandler) NavigateToRoute(page *rod.Page, route string) error
- func (h *AngularJSHandler) Type() Type
- func (h *AngularJSHandler) WaitForReady(page *rod.Page) error
- type DetectionResult
- type Detector
- func (d *Detector) Detect(page *rod.Page) *DetectionResult
- func (d *Detector) ExtractAllLinks(page *rod.Page) []Link
- func (d *Detector) ExtractAllRoutes(page *rod.Page) []Route
- func (d *Detector) GetHandler(t Type) Handler
- func (d *Detector) GetPrimaryHandler(page *rod.Page) Handler
- func (d *Detector) WaitForFrameworks(page *rod.Page) error
- type EmberHandler
- func (h *EmberHandler) Detect(page *rod.Page) bool
- func (h *EmberHandler) ExtractLinks(page *rod.Page) ([]Link, error)
- func (h *EmberHandler) ExtractRoutes(page *rod.Page) ([]Route, error)
- func (h *EmberHandler) GetRouteChangeScript() string
- func (h *EmberHandler) NavigateToRoute(page *rod.Page, route string) error
- func (h *EmberHandler) Type() Type
- func (h *EmberHandler) WaitForReady(page *rod.Page) error
- type GenericHandler
- func (h *GenericHandler) Detect(page *rod.Page) bool
- func (h *GenericHandler) ExtractLinks(page *rod.Page) ([]Link, error)
- func (h *GenericHandler) ExtractRoutes(page *rod.Page) ([]Route, error)
- func (h *GenericHandler) GetRouteChangeScript() string
- func (h *GenericHandler) NavigateToRoute(page *rod.Page, route string) error
- func (h *GenericHandler) Type() Type
- func (h *GenericHandler) WaitForReady(page *rod.Page) error
- type Handler
- type Link
- type ReactHandler
- func (h *ReactHandler) Detect(page *rod.Page) bool
- func (h *ReactHandler) ExtractLinks(page *rod.Page) ([]Link, error)
- func (h *ReactHandler) ExtractRoutes(page *rod.Page) ([]Route, error)
- func (h *ReactHandler) GetRouteChangeScript() string
- func (h *ReactHandler) NavigateToRoute(page *rod.Page, route string) error
- func (h *ReactHandler) Type() Type
- func (h *ReactHandler) WaitForReady(page *rod.Page) error
- type Route
- type Type
- type VueHandler
- func (h *VueHandler) Detect(page *rod.Page) bool
- func (h *VueHandler) ExtractLinks(page *rod.Page) ([]Link, error)
- func (h *VueHandler) ExtractRoutes(page *rod.Page) ([]Route, error)
- func (h *VueHandler) GetRouteChangeScript() string
- func (h *VueHandler) NavigateToRoute(page *rod.Page, route string) error
- func (h *VueHandler) Type() Type
- func (h *VueHandler) WaitForReady(page *rod.Page) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AngularHandler ¶
type AngularHandler struct{}
AngularHandler handles Angular 2+ applications.
func NewAngularHandler ¶
func NewAngularHandler() *AngularHandler
NewAngularHandler creates a new Angular handler.
func (*AngularHandler) Detect ¶
func (h *AngularHandler) Detect(page *rod.Page) bool
Detect checks if Angular 2+ is present on the page.
func (*AngularHandler) ExtractLinks ¶
func (h *AngularHandler) ExtractLinks(page *rod.Page) ([]Link, error)
ExtractLinks extracts all navigation links from the page.
func (*AngularHandler) ExtractRoutes ¶
func (h *AngularHandler) ExtractRoutes(page *rod.Page) ([]Route, error)
ExtractRoutes extracts all routes from Angular application.
func (*AngularHandler) GetRouteChangeScript ¶
func (h *AngularHandler) GetRouteChangeScript() string
GetRouteChangeScript returns JavaScript to detect route changes.
func (*AngularHandler) NavigateToRoute ¶
func (h *AngularHandler) NavigateToRoute(page *rod.Page, route string) error
NavigateToRoute navigates to a specific route within the SPA.
func (*AngularHandler) WaitForReady ¶
func (h *AngularHandler) WaitForReady(page *rod.Page) error
WaitForReady waits for Angular to be fully loaded.
type AngularJSHandler ¶
type AngularJSHandler struct{}
AngularJSHandler handles AngularJS 1.x applications.
func NewAngularJSHandler ¶
func NewAngularJSHandler() *AngularJSHandler
NewAngularJSHandler creates a new AngularJS handler.
func (*AngularJSHandler) Detect ¶
func (h *AngularJSHandler) Detect(page *rod.Page) bool
Detect checks if AngularJS 1.x is present on the page.
func (*AngularJSHandler) ExtractLinks ¶
func (h *AngularJSHandler) ExtractLinks(page *rod.Page) ([]Link, error)
ExtractLinks extracts all navigation links from the page.
func (*AngularJSHandler) ExtractRoutes ¶
func (h *AngularJSHandler) ExtractRoutes(page *rod.Page) ([]Route, error)
ExtractRoutes extracts all routes from AngularJS application.
func (*AngularJSHandler) GetRouteChangeScript ¶
func (h *AngularJSHandler) GetRouteChangeScript() string
GetRouteChangeScript returns JavaScript to detect route changes.
func (*AngularJSHandler) NavigateToRoute ¶
func (h *AngularJSHandler) NavigateToRoute(page *rod.Page, route string) error
NavigateToRoute navigates to a specific route within the SPA.
func (*AngularJSHandler) Type ¶
func (h *AngularJSHandler) Type() Type
Type returns the framework type.
func (*AngularJSHandler) WaitForReady ¶
func (h *AngularJSHandler) WaitForReady(page *rod.Page) error
WaitForReady waits for AngularJS to be fully loaded.
type DetectionResult ¶
type DetectionResult struct {
Frameworks []Type
Primary Type
Version string
IsSPA bool
HasRouter bool
RouterType string
}
DetectionResult contains the result of framework detection.
type Detector ¶
type Detector struct {
// contains filtered or unexported fields
}
Detector detects frameworks on a page.
func NewDetector ¶
func NewDetector() *Detector
NewDetector creates a new framework detector with all handlers.
func (*Detector) Detect ¶
func (d *Detector) Detect(page *rod.Page) *DetectionResult
Detect detects all frameworks present on the page.
func (*Detector) ExtractAllLinks ¶
ExtractAllLinks extracts links using all applicable handlers.
func (*Detector) ExtractAllRoutes ¶
ExtractAllRoutes extracts routes using all applicable handlers.
func (*Detector) GetHandler ¶
GetHandler returns the appropriate handler for a framework type.
func (*Detector) GetPrimaryHandler ¶
GetPrimaryHandler returns the handler for the primary detected framework.
type EmberHandler ¶
type EmberHandler struct{}
EmberHandler handles Ember.js applications.
func NewEmberHandler ¶
func NewEmberHandler() *EmberHandler
NewEmberHandler creates a new Ember handler.
func (*EmberHandler) Detect ¶
func (h *EmberHandler) Detect(page *rod.Page) bool
Detect checks if Ember.js is present on the page.
func (*EmberHandler) ExtractLinks ¶
func (h *EmberHandler) ExtractLinks(page *rod.Page) ([]Link, error)
ExtractLinks extracts all navigation links from the page.
func (*EmberHandler) ExtractRoutes ¶
func (h *EmberHandler) ExtractRoutes(page *rod.Page) ([]Route, error)
ExtractRoutes extracts all routes from Ember application.
func (*EmberHandler) GetRouteChangeScript ¶
func (h *EmberHandler) GetRouteChangeScript() string
GetRouteChangeScript returns JavaScript to detect route changes.
func (*EmberHandler) NavigateToRoute ¶
func (h *EmberHandler) NavigateToRoute(page *rod.Page, route string) error
NavigateToRoute navigates to a specific route within the SPA.
func (*EmberHandler) WaitForReady ¶
func (h *EmberHandler) WaitForReady(page *rod.Page) error
WaitForReady waits for Ember to be fully loaded.
type GenericHandler ¶
type GenericHandler struct{}
GenericHandler handles generic SPAs and traditional pages.
func NewGenericHandler ¶
func NewGenericHandler() *GenericHandler
NewGenericHandler creates a new generic handler.
func (*GenericHandler) Detect ¶
func (h *GenericHandler) Detect(page *rod.Page) bool
Detect always returns true as this is the fallback handler.
func (*GenericHandler) ExtractLinks ¶
func (h *GenericHandler) ExtractLinks(page *rod.Page) ([]Link, error)
ExtractLinks extracts all navigation links from the page.
func (*GenericHandler) ExtractRoutes ¶
func (h *GenericHandler) ExtractRoutes(page *rod.Page) ([]Route, error)
ExtractRoutes extracts all routes from the page.
func (*GenericHandler) GetRouteChangeScript ¶
func (h *GenericHandler) GetRouteChangeScript() string
GetRouteChangeScript returns JavaScript to detect route changes.
func (*GenericHandler) NavigateToRoute ¶
func (h *GenericHandler) NavigateToRoute(page *rod.Page, route string) error
NavigateToRoute navigates to a specific route.
func (*GenericHandler) WaitForReady ¶
func (h *GenericHandler) WaitForReady(page *rod.Page) error
WaitForReady waits for the page to be fully loaded.
type Handler ¶
type Handler interface {
// Type returns the framework type.
Type() Type
// Detect checks if this framework is present on the page.
Detect(page *rod.Page) bool
// WaitForReady waits for the framework to be fully loaded.
WaitForReady(page *rod.Page) error
// ExtractRoutes extracts all routes defined in the application.
ExtractRoutes(page *rod.Page) ([]Route, error)
// ExtractLinks extracts all navigation links from the page.
ExtractLinks(page *rod.Page) ([]Link, error)
NavigateToRoute(page *rod.Page, route string) error
// GetRouteChangeScript returns JavaScript to detect route changes.
GetRouteChangeScript() string
}
Handler defines the interface for framework-specific handling.
type Link ¶
type Link struct {
URL string
Text string
Attributes map[string]string
Type string // "href", "router-link", "ng-href", etc.
}
Link represents a discovered link.
type ReactHandler ¶
type ReactHandler struct{}
ReactHandler handles React applications.
func NewReactHandler ¶
func NewReactHandler() *ReactHandler
NewReactHandler creates a new React handler.
func (*ReactHandler) Detect ¶
func (h *ReactHandler) Detect(page *rod.Page) bool
Detect checks if React is present on the page.
func (*ReactHandler) ExtractLinks ¶
func (h *ReactHandler) ExtractLinks(page *rod.Page) ([]Link, error)
ExtractLinks extracts all navigation links from the page.
func (*ReactHandler) ExtractRoutes ¶
func (h *ReactHandler) ExtractRoutes(page *rod.Page) ([]Route, error)
ExtractRoutes extracts all routes from React application.
func (*ReactHandler) GetRouteChangeScript ¶
func (h *ReactHandler) GetRouteChangeScript() string
GetRouteChangeScript returns JavaScript to detect route changes.
func (*ReactHandler) NavigateToRoute ¶
func (h *ReactHandler) NavigateToRoute(page *rod.Page, route string) error
NavigateToRoute navigates to a specific route within the SPA.
func (*ReactHandler) WaitForReady ¶
func (h *ReactHandler) WaitForReady(page *rod.Page) error
WaitForReady waits for React to be fully loaded.
type Route ¶
type Route struct {
Path string // Route path (e.g., "/users", "#/popular")
Name string // Route name if available
Component string // Component name if available
Parameters []string // Route parameters (e.g., ":id", ":slug")
Meta map[string]string // Additional metadata
}
Route represents a discovered route.
type Type ¶
type Type string
Type represents a JavaScript framework type.
const ( TypeUnknown Type = "unknown" TypeAngularJS Type = "angularjs" // AngularJS 1.x TypeAngular Type = "angular" // Angular 2+ TypeReact Type = "react" TypeVue Type = "vue" TypeEmber Type = "ember" TypeBackbone Type = "backbone" TypeSvelte Type = "svelte" TypeNext Type = "nextjs" TypeNuxt Type = "nuxt" TypeGatsby Type = "gatsby" )
type VueHandler ¶
type VueHandler struct{}
VueHandler handles Vue.js applications.
func (*VueHandler) Detect ¶
func (h *VueHandler) Detect(page *rod.Page) bool
Detect checks if Vue.js is present on the page.
func (*VueHandler) ExtractLinks ¶
func (h *VueHandler) ExtractLinks(page *rod.Page) ([]Link, error)
ExtractLinks extracts all navigation links from the page.
func (*VueHandler) ExtractRoutes ¶
func (h *VueHandler) ExtractRoutes(page *rod.Page) ([]Route, error)
ExtractRoutes extracts all routes from Vue application.
func (*VueHandler) GetRouteChangeScript ¶
func (h *VueHandler) GetRouteChangeScript() string
GetRouteChangeScript returns JavaScript to detect route changes.
func (*VueHandler) NavigateToRoute ¶
func (h *VueHandler) NavigateToRoute(page *rod.Page, route string) error
NavigateToRoute navigates to a specific route within the SPA.
func (*VueHandler) WaitForReady ¶
func (h *VueHandler) WaitForReady(page *rod.Page) error
WaitForReady waits for Vue to be fully loaded.