viteutil

package
v0.82.0 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2026 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Index

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

func FindAllDependencies(manifest Manifest, importPath string) []string

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

func FindRelativeEntrypointPath(manifest Manifest, entrypointToFind string) (string, error)

FindRelativeEntrypointPath finds the manifest key for a given entry point file

func GetVitePortStr

func GetVitePortStr() string

func InitPort

func InitPort(defaultPort int) (int, error)

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

func (*BuildCtx) Cleanup

func (c *BuildCtx) Cleanup()

func (*BuildCtx) DevBuild

func (c *BuildCtx) DevBuild() error

func (*BuildCtx) GetPort

func (c *BuildCtx) GetPort() int

func (*BuildCtx) ProdBuild

func (c *BuildCtx) ProdBuild() error

func (*BuildCtx) Wait

func (c *BuildCtx) Wait()

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 Manifest

type Manifest map[string]ManifestChunk

func ReadManifest

func ReadManifest(manifestPath string) (Manifest, error)

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

type ToDevScriptsOptions struct {
	ClientEntry string
	Variant     Variant
}

type Variant

type Variant string

Jump to

Keyboard shortcuts

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