Documentation
¶
Index ¶
- Constants
- Variables
- func FindAllDependencies(manifest Manifest, importPath string) []string
- func FindRelativeEntrypointPath(manifest Manifest, entrypointToFind string) (string, error)
- func GetVitePortStr() string
- func InitPort(defaultPort int) (int, error)
- func ToDevScripts(options ToDevScriptsOptions) (template.HTML, error)
- type BuildCtx
- type BuildCtxOptions
- type Manifest
- type ManifestChunk
- type ToDevScriptsOptions
- type Variant
Constants ¶
View Source
const PortEnvName = "__VITE_PORT"
Variables ¶
View Source
var Log = colorlog.New("viteutil")
View Source
var Variants = struct { React Variant Other Variant }{ React: "react", Other: "other", }
Functions ¶
func FindAllDependencies ¶
FindAllDependencies recursively finds all of a module's dependencies according to the provided Vite manifest. The importPath arg should be a key in the manifest map.
func FindRelativeEntrypointPath ¶
FindRelativeEntrypointPath finds the manifest key for a given entry point file
func GetVitePortStr ¶
func GetVitePortStr() string
func ToDevScripts ¶
func ToDevScripts(options ToDevScriptsOptions) (template.HTML, error)
Types ¶
type BuildCtx ¶
type BuildCtx struct {
// contains filtered or unexported fields
}
func NewBuildCtx ¶
func NewBuildCtx(opts *BuildCtxOptions) *BuildCtx
type BuildCtxOptions ¶
type BuildCtxOptions struct {
// required -- e.g., "npx", "pnpm", "yarn", "bunx", etc.
JSPackageManagerBaseCmd string
// optional -- used for monorepos that need to run commands from ancestor directories
JSPackageManagerCmdDir string
// required
OutDir string
// required
ManifestOut string
// optional -- default is 5173
DefaultPort int
// optional
ViteConfigFile string
}
type ManifestChunk ¶
type ManifestChunk struct {
Src string `json:"src"`
File string `json:"file"`
CSS []string `json:"css"`
Assets []string `json:"assets"`
IsEntry bool `json:"isEntry"`
Name string `json:"name"`
IsDynamicEntry bool `json:"isDynamicEntry"`
Imports []string `json:"imports"`
DynamicImports []string `json:"dynamicImports"`
}
type ToDevScriptsOptions ¶
Click to show internal directories.
Click to hide internal directories.