angularinspector

package
v0.0.0-...-fb7f86c Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2023 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// AlwaysAngularFakeInspector is an inspector that always returns `true, nil`
	AlwaysAngularFakeInspector = &FakeInspector{
		InspectFunc: func(_ context.Context, _ *plugins.Plugin) (bool, error) {
			return true, nil
		},
	}

	// NeverAngularFakeInspector is an inspector that always returns `false, nil`
	NeverAngularFakeInspector = &FakeInspector{
		InspectFunc: func(_ context.Context, _ *plugins.Plugin) (bool, error) {
			return false, nil
		},
	}
)

Functions

func NewDefaultStaticDetectorsProvider

func NewDefaultStaticDetectorsProvider() angulardetector.DetectorsProvider

NewDefaultStaticDetectorsProvider returns a new StaticDetectorsProvider with the default (static, hardcoded) angular detection patterns (defaultDetectors)

Types

type FakeInspector

type FakeInspector struct {
	// InspectFunc is the function called when calling Inspect()
	InspectFunc func(ctx context.Context, p *plugins.Plugin) (bool, error)
}

FakeInspector is an inspector whose Inspect function can be set to any function.

func (*FakeInspector) Inspect

func (i *FakeInspector) Inspect(ctx context.Context, p *plugins.Plugin) (bool, error)

type Inspector

type Inspector interface {
	// Inspect takes a plugin and checks if the plugin is using Angular.
	Inspect(ctx context.Context, p *plugins.Plugin) (bool, error)
}

Inspector can inspect a plugin and determine if it's an Angular plugin or not.

func NewStaticInspector

func NewStaticInspector() Inspector

NewStaticInspector returns the default Inspector, which is a PatternsListInspector that only uses the static (hardcoded) angular detection patterns.

type PatternsListInspector

type PatternsListInspector struct {
	// DetectorsProvider returns the detectors that will be used by Inspect.
	DetectorsProvider angulardetector.DetectorsProvider
}

PatternsListInspector is an Inspector that matches a plugin's module.js against all the patterns returned by the detectorsProvider, in sequence.

func (*PatternsListInspector) Inspect

func (i *PatternsListInspector) Inspect(ctx context.Context, p *plugins.Plugin) (isAngular bool, err error)

Jump to

Keyboard shortcuts

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