transformrt

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2023 License: MIT Imports: 8 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 Default added in v0.2.6

func Default(log log.Log, svelteCompiler *svelte.Compiler) (*Map, error)

Default transformer TODO: this was required to get DI working with the *view.Generator. We should remove this

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