common

package
v0.5.19 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var QuitOnErr bool

QuitOnErr Build vs local dev. Should probably be part of a config but for now if Doreload is true we set this also in serve

View Source
var UseMemFS = false

UseMemFS determines if local dev files are stored on disk or in memory

Functions

func BinSearchIndex added in v0.4.3

func BinSearchIndex(x string) int

BinSearchIndex finds where the element exists or where it would be inserted to keep slice sorted

func CRC32Hasher added in v0.4.3

func CRC32Hasher(b []byte) uint32

CRC32Hasher is a simple means to check for changes

func Caller

func Caller() string

Caller shows the line in was from.

func CheckErr

func CheckErr(err error) error

CheckErr is a basic common means to handle error logic.

func Entries added in v0.4.3

func Entries() *[]string

Entries ok

func Exists added in v0.4.3

func Exists(k string) bool

Exists ok

func IsBuilding

func IsBuilding() bool

IsBuilding tells us if already in a build. if true then already at 1 0 != 1

func IsLocked added in v0.4.3

func IsLocked() bool

IsLocked just swaps from 1-0

func Lock

func Lock()

Lock just swaps from 0-1

func Remove added in v0.4.3

func Remove(k string)

Remove keeps entries and fs in sync

func SearchPath added in v0.4.3

func SearchPath(path string) (string, error)

SearchPath starts at path and looks for .js|.mjs. Need the error so we stop the build if filecannot be found..

func Set added in v0.4.3

func Set(k, sourceFile string, v *FData)

Set ok

func StartFrom added in v0.4.3

func StartFrom(x string) <-chan string

log n search to start point, might just be as well slicing...

func Unlock

func Unlock()

Unlock just swaps from 1-0

Types

type FData added in v0.4.3

type FData struct {
	// store content/css/ssr per component/layout.
	// B can be the concatenated css for bundle.css, the layout file bytes or the compiled component.
	// If memory is an issue maybe let a flag decide what we keep in mem.
	B []byte
	// A component can have a script and maybe style so this applies in the latter case else it is nil.
	// Might be a litle confusing to see stylePath storing/using B and CSS getting appended but CSS is each component's css
	// of which we combine all.
	CSS []byte
	// Used to store prev compiled ssr which is reused if no changes to layout file.
	SSR []byte
	// flag that is used for now to signify that once file has been processed once it doesn't need to be done again.
	// This is specific to gopack for now anyway
	// Hash of last check
	Hash      uint32
	Processed bool
}

FData todo: maybe keep local and have fucntions to do the work

func Get added in v0.4.3

func Get(k string) *FData

Get ok

func GetOrSet added in v0.4.3

func GetOrSet(k, sourceFile string) *FData

GetOrSet wil return existing or new "empty" FData. Used for the layouts now.

func (*FData) String added in v0.4.3

func (f *FData) String() string

type MapFS added in v0.4.3

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

type MapFST added in v0.4.3

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

MapFST just serves a purpose of holding buildDir and implementing serveHTTP so we are a HandlerFunc

func NewH added in v0.4.3

func NewH(buildDir string) *MapFST

NewH ok

func (*MapFST) ServeHTTP added in v0.4.3

func (h *MapFST) ServeHTTP(w http.ResponseWriter, r *http.Request)

Basically the inverse of StripPrefix logic. There is an overlap with names that breaks things as one can overwrite the other, "public"+... avoids this. eventually this and basically all other build related logic could become a "Builder" type that stores all config etc..

Jump to

Keyboard shortcuts

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