webwrap

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2023 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BundlerModeKey string = "bundler-mode"
)

Variables

View Source
var ErrComponentExport = errors.New("prefer capitalization for jsx components")
View Source
var ErrInvalidComponent = errors.New("invalid jsx component")

Functions

This section is empty.

Types

type BaseBundler added in v0.7.0

type BaseBundler struct {
	Mode           BundlerMode
	WebDir         string
	PageOutputDir  string
	NodeModulesDir string
	Logger         log.Logger
}

type BaseWebWrapper

type BaseWebWrapper struct {
	WebDir string
}

type BundleConfigurator added in v0.16.0

type BundleConfigurator struct {
	// ConfiguratorPage represents a bundler setup file
	Page     jsparse.JSDocument
	FilePath string
}

type BundleOpts added in v0.7.0

type BundleOpts struct {
	FileName  string
	BundleKey string
	Name      string
}

type BundledResource added in v0.7.0

type BundledResource struct {
	Configurators          []BundleConfigurator
	BundleOpFileDescriptor map[string]string
}

type BundlerKey added in v0.7.0

type BundlerKey string
const (
	BundlerID BundlerKey = "bundlerID"
)

type BundlerMode added in v0.7.0

type BundlerMode string
const (
	ProductionBundle  BundlerMode = "production"
	DevelopmentBundle BundlerMode = "development"
)

type CacheDOMOpts

type CacheDOMOpts struct {
	CacheDir  string
	WebPrefix string
}

func (*CacheDOMOpts) CacheWebRequest

func (c *CacheDOMOpts) CacheWebRequest(uris []string) ([]string, error)

type JSWebWrapper

type JSWebWrapper interface {
	Apply(jsparse.JSDocument) (map[string]jsparse.JSDocument, error)
	Bundle(configuratorFile string, originalFilePath string) error
	DoesSatisfyConstraints(jsparse.JSDocument) bool
	RequiredBodyDOMElements(context.Context, *CacheDOMOpts) []string
	HydrationFile() []embedutils.FileReader
	Setup(context.Context, *BundleOpts) (*BundledResource, error)
	Stats() *WrapStats
	VerifyRequirements() error
	Version() string
}

func NewReactHydrate added in v0.21.0

func NewReactHydrate(bundler *BaseBundler) JSWebWrapper

type JSWebWrapperList

type JSWebWrapperList []JSWebWrapper

func NewActiveMap

func NewActiveMap(bundler *BaseBundler) JSWebWrapperList

func (JSWebWrapperList) FindFirst added in v0.21.0

func (j JSWebWrapperList) FindFirst(page jsparse.JSDocument) JSWebWrapper

func (JSWebWrapperList) VerifyAll added in v0.10.0

func (l JSWebWrapperList) VerifyAll() error

type JavascriptWrap added in v0.21.0

type JavascriptWrap struct {
	*BaseWebWrapper
	*BaseBundler
}

func (*JavascriptWrap) Apply added in v0.21.0

func (*JavascriptWrap) Bundle added in v0.21.0

func (b *JavascriptWrap) Bundle(configuratorFilePath string, filePath string) error

func (*JavascriptWrap) DoesSatisfyConstraints added in v0.21.0

func (s *JavascriptWrap) DoesSatisfyConstraints(page jsparse.JSDocument) bool

func (*JavascriptWrap) HydrationFile added in v0.21.0

func (b *JavascriptWrap) HydrationFile() []embedutils.FileReader

func (*JavascriptWrap) RequiredBodyDOMElements added in v0.21.0

func (s *JavascriptWrap) RequiredBodyDOMElements(ctx context.Context, cache *CacheDOMOpts) []string

func (*JavascriptWrap) Setup added in v0.21.0

func (b *JavascriptWrap) Setup(ctx context.Context, settings *BundleOpts) (*BundledResource, error)

func (*JavascriptWrap) Stats added in v0.21.0

func (s *JavascriptWrap) Stats() *WrapStats

func (*JavascriptWrap) VerifyRequirements added in v0.21.0

func (b *JavascriptWrap) VerifyRequirements() error

func (*JavascriptWrap) Version added in v0.21.0

func (s *JavascriptWrap) Version() string

type NewReactSSROpts added in v0.7.0

type NewReactSSROpts struct {
	SourceMapDoc *jsparse.DefaultJSDocument
	InitDoc      *jsparse.DefaultJSDocument
	Bundler      *BaseBundler
}

type PartialWrapReactSSR added in v0.21.0

type PartialWrapReactSSR struct {
	*BaseWebWrapper
	*BaseBundler
	// contains filtered or unexported fields
}

func NewReactSSRPartial added in v0.21.0

func NewReactSSRPartial(opts *NewReactSSROpts) *PartialWrapReactSSR

func (*PartialWrapReactSSR) Apply added in v0.21.0

func (*PartialWrapReactSSR) Setup added in v0.21.0

func (r *PartialWrapReactSSR) Setup(ctx context.Context, settings *BundleOpts) (*BundledResource, error)

func (*PartialWrapReactSSR) VerifyRequirements added in v0.21.0

func (r *PartialWrapReactSSR) VerifyRequirements() error

type ReactCSR added in v0.21.0

type ReactCSR struct {
	*BaseWebWrapper
	*BaseBundler
}

func NewReactCSR added in v0.21.0

func NewReactCSR(bundler *BaseBundler) *ReactCSR

func (*ReactCSR) Apply added in v0.21.0

func (s *ReactCSR) Apply(page jsparse.JSDocument) (map[string]jsparse.JSDocument, error)

func (*ReactCSR) Bundle added in v0.21.0

func (b *ReactCSR) Bundle(configuratorFilePath string, filePath string) error

func (*ReactCSR) DoesSatisfyConstraints added in v0.21.0

func (b *ReactCSR) DoesSatisfyConstraints(page jsparse.JSDocument) bool

func (*ReactCSR) HydrationFile added in v0.21.0

func (b *ReactCSR) HydrationFile() []embedutils.FileReader

func (*ReactCSR) RequiredBodyDOMElements added in v0.21.0

func (s *ReactCSR) RequiredBodyDOMElements(ctx context.Context, cache *CacheDOMOpts) []string

func (*ReactCSR) Setup added in v0.21.0

func (b *ReactCSR) Setup(ctx context.Context, settings *BundleOpts) (*BundledResource, error)

func (*ReactCSR) Stats added in v0.21.0

func (s *ReactCSR) Stats() *WrapStats

func (*ReactCSR) VerifyRequirements added in v0.21.0

func (r *ReactCSR) VerifyRequirements() error

func (*ReactCSR) Version added in v0.21.0

func (s *ReactCSR) Version() string

type ReactHydrate added in v0.21.0

type ReactHydrate struct {
	// contains filtered or unexported fields
}

func (*ReactHydrate) Apply added in v0.21.0

func (*ReactHydrate) Bundle added in v0.21.0

func (b *ReactHydrate) Bundle(configuratorFilePath string, filePath string) error

func (*ReactHydrate) DoesSatisfyConstraints added in v0.21.0

func (b *ReactHydrate) DoesSatisfyConstraints(page jsparse.JSDocument) bool

func (*ReactHydrate) HydrationFile added in v0.21.0

func (b *ReactHydrate) HydrationFile() []embedutils.FileReader

func (*ReactHydrate) RequiredBodyDOMElements added in v0.21.0

func (s *ReactHydrate) RequiredBodyDOMElements(ctx context.Context, cache *CacheDOMOpts) []string

func (*ReactHydrate) Setup added in v0.21.0

func (b *ReactHydrate) Setup(ctx context.Context, settings *BundleOpts) (*BundledResource, error)

func (*ReactHydrate) Stats added in v0.21.0

func (s *ReactHydrate) Stats() *WrapStats

func (*ReactHydrate) VerifyRequirements added in v0.21.0

func (r *ReactHydrate) VerifyRequirements() error

func (*ReactHydrate) Version added in v0.21.0

func (s *ReactHydrate) Version() string

type WrapStats added in v0.16.0

type WrapStats struct {
	WebVersion string
	Bundler    string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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