sorvor

package
v0.4.7 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2021 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package sorvor is an extremely fast, zero config ServeIndex for modern web applications.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildCache added in v0.4.5

type BuildCache map[string]api.OutputFile

type Sorvor

type Sorvor struct {
	BuildOptions api.BuildOptions
	Entry        string
	Host         string
	Port         string
	Serve        bool
	Secure       bool
	Pkg          *pkgjson.PkgJSON
}

Sorvor struct

func (*Sorvor) BuildEntry

func (serv *Sorvor) BuildEntry(entry string) ([]string, api.BuildResult)

BuildEntry builds a given entrypoint using esbuild

func (*Sorvor) BuildIndex

func (serv *Sorvor) BuildIndex(pkg *pkgjson.PkgJSON, cache BuildCache) []string

BuildIndex walks the index.html, collect all the entries from <script...></script> and <link .../> tags it then runs it through esbuild and replaces the references in index.html with new paths

func (*Sorvor) RunEntry

func (serv *Sorvor) RunEntry(entry string)

RunEntry builds an entrypoint and launches the resulting built file using node.js

func (*Sorvor) ServeHTTP

func (serv *Sorvor) ServeHTTP(res http.ResponseWriter, request *http.Request)

ServeHTTP is an http server handler for sorvor

func (*Sorvor) ServeIndex

func (serv *Sorvor) ServeIndex(pkg *pkgjson.PkgJSON)

ServeIndex launches esbuild in watch mode and live reloads all connected browsers

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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