Documentation ¶
Index ¶
Constants ¶
View Source
const ( DEFAULT_VITE_VERSION = "3" DEFAULT_PORT_V2 = "3000" DEFAULT_PORT_V3 = "5173" )
constants
Variables ¶
Functions ¶
This section is empty.
Types ¶
type JSAppParams ¶ added in v0.4.0
type JSAppParams struct { JSHash string `json:"hash"` ViteVersion string `json:"vite_version"` ViteMajorVer string `json:"vite_major_version"` PackageType string `json:"package_type"` MajorVer string `json:"major_version,omitempty"` EntryPoint string `json:"entry_point"` HasTypeScript bool `json:"has_ts"` IsVanilla bool `json:"is_vanilla,omitempty"` VueVersion string `json:"vue_version,omitempty"` ReactVersion string `json:"react_version,omitempty"` PreactVersion string `json:"preact_version,omitempty"` SvelteVersion string `json:"svelte_version,omitempty"` LitVersion string `json:"lit_version,omitempty"` }
type PackageJSON ¶ added in v0.3.2
type ViteConfig ¶ added in v0.1.0
type ViteConfig struct { // FS is the filesystem where assets can be loaded. FS fs.FS // DevDefaults is best guess for defaults DevDefaults *JSAppParams `json:"-"` // Environment (development|production). In development mode, // the package sets up hot reloading. In production, the // package builds the Vue/Vuex production files and embeds them // in the Go app. Environment string // JSProjectPath is where your JS project is relative to the // root of your project. Default: frontend JSProjectPath string //AssetsPath relative to the JSProjectPath. Empty for dev, dist for prod AssetsPath string // "2" or "3". If not set, we try to guess by looking // at package.json ViteVersion string // DevServerDomain is what domain the dev server appears on. // Default is localhost. DevServerDomain string // DevServerPort is what port the dev server will appear on. // Default depends upon the ViteVersion. DevServerPort string // HTTPS is whether the dev server is encrypted or not. // Default is false. HTTPS bool // URLPrefix (/assets/ for prod, /src/ for dev) URLPrefix string // Platform (vue|react|svelte) is the target platform. // Default is "vue" Platform string // Entry point: as configured in vite.config.js. Typically // src/main.js or src/main.ts. EntryPoint string }
type ViteConfig passes info needed to generate the library's output.
func (*ViteConfig) SetDevelopmentDefaults ¶ added in v0.4.0
func (vc *ViteConfig) SetDevelopmentDefaults() error
func (*ViteConfig) SetProductionDefaults ¶ added in v0.4.1
func (vc *ViteConfig) SetProductionDefaults() error
type VueGlue ¶
type VueGlue struct { // Environment. This controls whether the library will // configure the host for hot updating, or whether it // needs to configure loading of a dist/ directory. Environment string // Entry point for JS MainModule string // BaseURL is the base URL for the dev server. // Default is http://localhost:5173 BaseURL string // JS Dependencies / Vendor libs Imports []string // Bundled CSS CSSModule []string // Target JS Platform Platform string // A file system or embed that points to the Vue/Vite dist // directory (production) or the javascript src directory // (development) DistFS fs.FS // DevServer is the URI of the Vite development server DevServer string // JSProjectPath is the location of the JS project. JSProjectPath string // AssetPath is the relative path from the JSDirectory. AssetPath string // Debug mode Debug bool }
type VueGlue summarizes a manifest file, and points to the assets.
func NewVueGlue ¶
func NewVueGlue(config *ViteConfig) (*VueGlue, error)
NewVueGlue finds the manifest in the supplied file system and returns a glue object.
func ParseManifest ¶
ParseManifest imports and parses a manifest returning a glue object.
func (*VueGlue) DevServerRedirector ¶ added in v0.3.0
func (*VueGlue) FileServer ¶ added in v0.1.4
FileServer is a customized version of http.FileServer that can handle either an embed.FS or a os.DirFS fs.FS. Since development directories used for hot updates can contain dot files (potentially with sensitive information) the code checks to make sure that dot files are not served.
type WriterWrapper ¶ added in v0.5.0
type WriterWrapper struct { Writer http.ResponseWriter RetCode int }
func NewRespWriter ¶ added in v0.5.5
func NewRespWriter(w http.ResponseWriter) *WriterWrapper
func (*WriterWrapper) Header ¶ added in v0.5.0
func (w *WriterWrapper) Header() http.Header
func (*WriterWrapper) Write ¶ added in v0.5.0
func (w *WriterWrapper) Write(buf []byte) (int, error)
func (*WriterWrapper) WriteHeader ¶ added in v0.5.0
func (w *WriterWrapper) WriteHeader(status int)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.