printer

package
v0.19.0-rc4 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ModifySource added in v0.19.0

func ModifySource(tag string, attrs gox.Attrs, src any) error

ModifySource sets src or href on tag to src.

func NewModPrinter added in v0.19.0

func NewModPrinter(printer gox.Printer, mods []gox.Modify) gox.Printer

func NewPagePrinter

func NewPagePrinter(w io.Writer, include gox.Elem, importMap []byte, meta gox.Comp) gox.Printer

func NewResourcePrinter

func NewResourcePrinter(printer gox.Printer) gox.Printer

Types

type Asset added in v0.19.0

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

func (*Asset) Prepare added in v0.19.0

func (a *Asset) Prepare(app core.App) (*resources.Resource, error)

func (*Asset) Resolve added in v0.19.0

func (a *Asset) Resolve(c core.Core) (string, error)

func (*Asset) SetContentType added in v0.19.0

func (a *Asset) SetContentType(contentType string)

func (*Asset) SetMode added in v0.19.0

func (r *Asset) SetMode(mode resources.ResourceMode) error

func (*Asset) SetName added in v0.19.0

func (r *Asset) SetName(name string)

func (*Asset) SetPortable added in v0.19.0

func (r *Asset) SetPortable(portable bool)

func (*Asset) SetSource added in v0.19.0

func (a *Asset) SetSource(v any) error

func (*Asset) Validate added in v0.19.0

func (a *Asset) Validate() error

type HandlerFunc

type HandlerFunc = func(ctx context.Context, w http.ResponseWriter, r *http.Request) bool

HandlerFunc serves a resource request. Returning true stops serving the resource after that request.

type HandlerSimpleFunc

type HandlerSimpleFunc = func(w http.ResponseWriter, r *http.Request)

HandlerSimpleFunc serves a resource request and keeps the resource available for later requests.

type ModJob added in v0.19.0

type ModJob interface {
	AddMod(m gox.Modify)
}

type Payload added in v0.10.0

type Payload interface {
	Free()
	Lock() bool
	Payload() (actions.Payload, bool)
	Release()
}

type PayloadPrinter

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

func NewPayloadPrinter

func NewPayloadPrinter(disableGzip bool, onRelease func(*PayloadPrinter)) *PayloadPrinter

func (*PayloadPrinter) Finalize

func (b *PayloadPrinter) Finalize()

func (*PayloadPrinter) Free added in v0.15.2

func (b *PayloadPrinter) Free()

func (*PayloadPrinter) Lock added in v0.15.2

func (b *PayloadPrinter) Lock() bool

func (*PayloadPrinter) Payload

func (b *PayloadPrinter) Payload() (actions.Payload, bool)

func (*PayloadPrinter) Release

func (b *PayloadPrinter) Release()

func (*PayloadPrinter) Send

func (b *PayloadPrinter) Send(job gox.Job) error

type Resource added in v0.19.0

type Resource interface {
	SetSource(any) error
	SetMode(resources.ResourceMode) error
	SetPortable(bool)
	SetName(string)
	Validate() error
	Prepare(core.App) (*resources.Resource, error)
	Resolve(core.Core) (string, error)
}

type Script added in v0.19.0

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

func (*Script) Prepare added in v0.19.0

func (s *Script) Prepare(app core.App) (*resources.Resource, error)

func (*Script) Resolve added in v0.19.0

func (s *Script) Resolve(c core.Core) (string, error)

func (*Script) SetMode added in v0.19.0

func (r *Script) SetMode(mode resources.ResourceMode) error

func (*Script) SetModule added in v0.19.0

func (s *Script) SetModule(module bool)

func (*Script) SetName added in v0.19.0

func (r *Script) SetName(name string)

func (*Script) SetOutput added in v0.19.0

func (s *Script) SetOutput(output scriptOutput) error

func (*Script) SetPortable added in v0.19.0

func (r *Script) SetPortable(portable bool)

func (*Script) SetProfile added in v0.19.0

func (s *Script) SetProfile(profile string)

func (*Script) SetSource added in v0.19.0

func (s *Script) SetSource(v any) error

func (*Script) SetTS added in v0.19.0

func (s *Script) SetTS(ts bool)

func (*Script) Validate added in v0.19.0

func (s *Script) Validate() error

type SourceBytes

type SourceBytes []byte

SourceBytes serves bytes held in memory.

func (SourceBytes) Handler

func (s SourceBytes) Handler() HandlerFunc

func (SourceBytes) Modify

func (s SourceBytes) Modify(_ context.Context, tag string, attrs gox.Attrs) error

func (SourceBytes) StaticEntry

func (s SourceBytes) StaticEntry() resources.StaticEntry

type SourceExternal

type SourceExternal string

SourceExternal is a URL the browser loads directly from another host.

Doors writes the URL unchanged. It adds the host to the generated Content-Security-Policy only for script tags and stylesheet or modulepreload links.

func (SourceExternal) Modify

func (s SourceExternal) Modify(_ context.Context, tag string, attrs gox.Attrs) error

func (SourceExternal) Output added in v0.8.5

func (s SourceExternal) Output(w io.Writer) error

type SourceFS

type SourceFS struct {
	FS    fs.FS
	Entry string
}

SourceFS serves the file at Entry from FS.

func (SourceFS) Handler

func (s SourceFS) Handler() HandlerFunc

func (SourceFS) Modify

func (s SourceFS) Modify(_ context.Context, tag string, attrs gox.Attrs) error

func (SourceFS) StaticEntry

func (s SourceFS) StaticEntry() resources.StaticEntry

type SourceHandler added in v0.8.5

type SourceHandler interface {
	gox.Modify
	Handler() HandlerFunc
}

SourceHandler is app-owned content that Doors serves under a generated src or href URL.

type SourceHook

type SourceHook func(ctx context.Context, w http.ResponseWriter, r *http.Request) bool

SourceHook serves a resource from a handler.

Requests are handled concurrently. Return true to stop serving the resource after that request, false to keep it available. The request body is not limited by ServerRequestBodyLimit.

func (SourceHook) Handler

func (s SourceHook) Handler() HandlerFunc

func (SourceHook) Modify

func (s SourceHook) Modify(_ context.Context, tag string, attrs gox.Attrs) error

type SourceLocalFS

type SourceLocalFS string

SourceLocalFS serves one file from the local filesystem by path.

func (SourceLocalFS) Handler

func (s SourceLocalFS) Handler() HandlerFunc

func (SourceLocalFS) Modify

func (s SourceLocalFS) Modify(_ context.Context, tag string, attrs gox.Attrs) error

func (SourceLocalFS) StaticEntry

func (s SourceLocalFS) StaticEntry() resources.StaticEntry

type SourceProxy

type SourceProxy string

SourceProxy serves a resource by reverse-proxying requests to a URL.

If the URL cannot be parsed, requests fail with status 500.

func (SourceProxy) Handler

func (s SourceProxy) Handler() HandlerFunc

func (SourceProxy) Modify

func (s SourceProxy) Modify(_ context.Context, tag string, attrs gox.Attrs) error

type SourceStatic

type SourceStatic interface {
	SourceHandler
	StaticEntry() resources.StaticEntry
	// contains filtered or unexported methods
}

SourceStatic is content Doors reads up front.

type SourceString

type SourceString string

SourceString serves string content held in memory.

func (SourceString) Handler

func (s SourceString) Handler() HandlerFunc

func (SourceString) Modify

func (s SourceString) Modify(_ context.Context, tag string, attrs gox.Attrs) error

func (SourceString) StaticEntry

func (s SourceString) StaticEntry() resources.StaticEntry

type Style added in v0.19.0

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

func (*Style) Prepare added in v0.19.0

func (s *Style) Prepare(app core.App) (*resources.Resource, error)

func (*Style) Resolve added in v0.19.0

func (s *Style) Resolve(c core.Core) (string, error)

func (*Style) SetMode added in v0.19.0

func (r *Style) SetMode(mode resources.ResourceMode) error

func (*Style) SetName added in v0.19.0

func (r *Style) SetName(name string)

func (*Style) SetPortable added in v0.19.0

func (r *Style) SetPortable(portable bool)

func (*Style) SetRaw added in v0.19.0

func (s *Style) SetRaw()

func (*Style) SetSource added in v0.19.0

func (s *Style) SetSource(v any) error

func (*Style) Validate added in v0.19.0

func (s *Style) Validate() error

Jump to

Keyboard shortcuts

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