aviator

package module
v0.0.0-...-41600d1 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2022 License: MIT Imports: 10 Imported by: 0

README

Aviator Logo

Aviator lets your application serve server-side rendered (SSR) Svelte in Go. Think SvelteKit but in Go. Aviator is only concerned with rendering Svelte pages and doesn't know anything about serving HTTP requests so users are free to use their favorite HTTP libraries. It also doesn't force any Go project structure on the user.

One of the main goals of the project is to be able to use any npm package. Most packages work, but some packages that use some ES6 features might not work (see below for list of known issues).

Aviator is pre-beta quality and not suitable for production use yet.

Known Issues And Roadmap

  • SSR errors could be much better. They should include stack traces
  • Only a dev build of JS and CSS assets are currently created which are unoptimized, not minified, and contain sourcemaps
  • Svelte compiler is currently bundled with Aviator, that means the library user must use the same version in it's package.json. In the future, the svelte compiler will be built on application startup and cached.
  • Support for CSS pre-processors (tailwindcss, scss, postcss)
  • Typescript is support but not inside of .svelte files due to lack of TS pre-processor for svelte
  • Support for some ES6 features (modules, generators, async/await) - These will be added as soon as they're added into Goja

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Aviator

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

func NewAviator

func NewAviator(configs ...Option) *Aviator

func (*Aviator) GetStaticAsset

func (a *Aviator) GetStaticAsset(name string) ([]byte, string, bool)

GetStaticAsset returns a byte array contents of the static asset and a boolean indicating whether the static asset was found

func (*Aviator) Init

func (a *Aviator) Init() error

Init scans the contents of the configured view directory and starts watching for changes in dev mode. starts JS VM pool compiles svelte compiler

func (*Aviator) Render

func (a *Aviator) Render(
	ctx context.Context,
	viewPath string,
	props interface{},
) (string, error)

type Option

type Option func(config *Aviator)

func WithAssetOutputPath

func WithAssetOutputPath(path string) Option

func WithDevMode

func WithDevMode(isDevMode bool) Option

func WithHTMLLang

func WithHTMLLang(lang string) Option

func WithLogger

func WithLogger(l utils.Logger) Option

func WithNullLogger

func WithNullLogger() Option

func WithNumJsVMs

func WithNumJsVMs(numVMs int) Option

func WithStaticAssetRoute

func WithStaticAssetRoute(route string) Option

func WithViewsPath

func WithViewsPath(path string) Option

Directories

Path Synopsis
filenotify
Package filenotify provides a mechanism for watching file(s) for changes.
Package filenotify provides a mechanism for watching file(s) for changes.

Jump to

Keyboard shortcuts

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