-
Notifications
You must be signed in to change notification settings - Fork 1
/
kiruna.go
124 lines (112 loc) · 3.55 KB
/
kiruna.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
package kiruna
import (
"html/template"
"net/http"
ik "github.com/sjc5/kiruna/internal/kiruna"
"github.com/sjc5/kit/pkg/colorlog"
)
type Config = ik.Config
type DevConfig = ik.DevConfig
type Kiruna struct {
c *Config
}
// If you want to do a custom build command, just use
// Kiruna.BuildWithoutCompilingGo() instead of Kiruna.Build(),
// and then you can control your build yourself afterwards.
func (k Kiruna) Build() error {
return k.c.Build(true, false)
}
func (k Kiruna) BuildWithoutCompilingGo() error {
return k.c.Build(false, false)
}
func (k Kiruna) GetPublicFS() (UniversalFS, error) {
return k.c.GetPublicFS()
}
func (k Kiruna) GetPrivateFS() (UniversalFS, error) {
return k.c.GetPrivateFS()
}
func (k Kiruna) GetPublicURL(originalPublicURL string) string {
return k.c.GetPublicURL(originalPublicURL)
}
func (k Kiruna) MustStartDev(devConfig *DevConfig) {
k.c.DevConfig = devConfig
k.c.MustStartDev()
}
func (k Kiruna) GetCriticalCSS() template.CSS {
return template.CSS(k.c.GetCriticalCSS())
}
func (k Kiruna) GetStyleSheetURL() string {
return k.c.GetStyleSheetURL()
}
func (k Kiruna) GetRefreshScript() template.HTML {
return template.HTML(k.c.GetRefreshScript())
}
func (k Kiruna) GetRefreshScriptSha256Hash() string {
return k.c.GetRefreshScriptSha256Hash()
}
func (k Kiruna) GetCriticalCSSElementID() string {
return ik.CriticalCSSElementID
}
func (k Kiruna) GetStyleSheetElementID() string {
return ik.StyleSheetElementID
}
func (k Kiruna) GetUniversalFS() (UniversalFS, error) {
return k.c.GetUniversalFS()
}
func (k Kiruna) GetCriticalCSSStyleElement() template.HTML {
return k.c.GetCriticalCSSStyleElement()
}
func (k Kiruna) GetCriticalCSSStyleElementSha256Hash() string {
return k.c.GetCriticalCSSStyleElementSha256Hash()
}
func (k Kiruna) GetStyleSheetLinkElement() template.HTML {
return k.c.GetStyleSheetLinkElement()
}
func (k Kiruna) GetServeStaticHandler(pathPrefix string, addImmutableCacheHeaders bool) (http.Handler, error) {
return k.c.GetServeStaticHandler(pathPrefix, addImmutableCacheHeaders)
}
func (k Kiruna) MustGetServeStaticHandler(pathPrefix string, addImmutableCacheHeaders bool) http.Handler {
handler, err := k.c.GetServeStaticHandler(pathPrefix, addImmutableCacheHeaders)
if err != nil {
panic(err)
}
return handler
}
func (k Kiruna) GetPublicFileMap() (map[string]string, error) {
return k.c.GetPublicFileMap()
}
func (k Kiruna) GetPublicFileMapKeysBuildtime(excludedPrefixes []string) ([]string, error) {
return k.c.GetPublicFileMapKeysBuildtime(excludedPrefixes)
}
func (k Kiruna) GetPublicFileMapElements() template.HTML {
return k.c.GetPublicFileMapElements()
}
func (k Kiruna) GetPublicFileMapScriptSha256Hash() string {
return k.c.GetPublicFileMapScriptSha256Hash()
}
func (k Kiruna) GetPublicFileMapURL() string {
return k.c.GetPublicFileMapURL()
}
func (k Kiruna) ResolveCSSURLFuncArgs(css string) string {
return k.c.ResolveCSSURLFuncArgs(css)
}
func New(c *ik.Config) *Kiruna {
if c.Logger == nil {
c.Logger = colorlog.New("Kiruna")
}
c.RuntimeInitOnce()
return &Kiruna{c}
}
type WatchedFile = ik.WatchedFile
type WatchedFiles = ik.WatchedFiles
type OnChangeFunc = ik.OnChangeFunc
type OnChange = ik.OnChange
type IgnorePatterns = ik.IgnorePatterns
type UniversalFS = ik.UniversalFS
const OnChangeStrategyConcurrent = ik.OnChangeStrategyConcurrent
const OnChangeStrategyPost = ik.OnChangeStrategyPost
const OnChangeStrategyPre = ik.OnChangeStrategyPre
const OnChangeStrategyConcurrentNoWait = ik.OnChangeStrategyConcurrentNoWait
var SetupDistDir = ik.SetupDistDir
var MustGetPort = ik.MustGetPort
var GetIsDev = ik.GetIsDev