transform

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DOM

type DOM struct {
	Map *Map
}

func (*DOM) Plugins

func (d *DOM) Plugins() []esbuild.Plugin

func (*DOM) Transform

func (d *DOM) Transform(fromPath, toPath string, code []byte) ([]byte, error)

type File

type File struct {
	Code []byte
	// contains filtered or unexported fields
}

func (*File) Path

func (f *File) Path() string

type Map

type Map struct {
	DOM *transformer
	SSR *transformer
}

Map aggregates all the platform-specific transformers

func Load

func Load(transformables ...*Transformable) (*Map, error)

func MustLoad

func MustLoad(transformables ...*Transformable) *Map

type Platform

type Platform int

Platform we're transforming to.

const (
	PlatformAll Platform = iota
	PlatformDOM
	PlatformSSR
)

type Platforms

type Platforms map[Platform]func(file *File) error

type SSR

type SSR struct {
	Map *Map
}

func (*SSR) Plugins

func (d *SSR) Plugins() []esbuild.Plugin

func (*SSR) Transform

func (d *SSR) Transform(fromPath, toPath string, code []byte) ([]byte, error)

type Transformable

type Transformable struct {
	To   string
	From string
	For  Platforms
}

type Transformer

type Transformer interface {
	Transform(fromPath, toPath string, code []byte) ([]byte, error)
	Plugins() (plugins []esbuild.Plugin)
}

Jump to

Keyboard shortcuts

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