clientbuilder

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModeDev  = "dev"
	ModeProd = "prod"
)
View Source
const PublicClientPrefix = "/_gox/client"

Variables

This section is empty.

Functions

func BuildFrameworkVendors

func BuildFrameworkVendors(node toolchain.NodePaths, pnpm toolchain.PNPMPaths, projectRoot string, frameworks []string) error

BuildFrameworkVendors builds only the stable production vendor files for the requested frameworks. Existing complete vendor sets are reused. Builds for the same project/framework are serialized so startup, compiler builds, and hot reload cannot write the same vendor output concurrently.

func BuildIdentity

func BuildIdentity(framework string, sourcePath string, mode string, dev bool) string

BuildIdentity returns the canonical identity of a client build. Declaration names and .gox module paths are intentionally excluded so equivalent declarations can reuse the same artifact.

func DetectFrameworkWorkspaces

func DetectFrameworkWorkspaces(projectRoot string) []string

DetectFrameworkWorkspaces returns the managed client frameworks installed in the project's client directory.

func ExtractClientDependencyGraphsFromOutput

func ExtractClientDependencyGraphsFromOutput(assets []Asset, output string) (map[string]ClientDependencyGraph, error)

func FrameworkImportSpecifiers

func FrameworkImportSpecifiers(framework string) []string

func FrameworkVendorOutputsExist

func FrameworkVendorOutputsExist(projectRoot string, framework string) bool

FrameworkVendorOutputsExist reports whether every stable production vendor facade for framework already exists in the project client output directory.

func FrameworkVersion

func FrameworkVersion(projectRoot string, framework string) (string, error)

FrameworkVersion returns the effective installed framework version from the framework workspace node_modules package metadata.

func GenerateViteConfig

func GenerateViteConfig(asset Asset) ([]byte, error)

func GenerateViteFrameworkVendorConfig

func GenerateViteFrameworkVendorConfig(asset Asset, outputAbsDir string, facades []frameworkModuleFacade, frameworkVersion string) ([]byte, error)

func GenerateViteGroupConfig

func GenerateViteGroupConfig(assets []Asset, outputAbsDir string) ([]byte, error)

func InstallFrameworkWorkspace

func InstallFrameworkWorkspace(node toolchain.NodePaths, pnpm toolchain.PNPMPaths, workspace FrameworkWorkspace) error

func IsViteWorkspaceInstalled

func IsViteWorkspaceInstalled(asset Asset) bool

func LoadClientCache

func LoadClientCache(root string)

LoadClientCache loads and reconciles the persisted client bundle cache for a project root. It is intentionally called at server startup, before the server starts accepting requests.

func ManagedDependencies

func ManagedDependencies(framework string) (dependencies map[string]string, devDependencies map[string]string, ok bool)

func NormalizeMode

func NormalizeMode(mode string, dev bool) string

func ProjectManagedDependencies

func ProjectManagedDependencies(projectRoot, framework string) (dependencies map[string]string, devDependencies map[string]string, err error)

func PublicBaseName

func PublicBaseName(name string, framework string, path string, mode string) string

func PublicComponentDirName

func PublicComponentDirName(name string, framework string, path string, mode string) string

func PublicEntryURL

func PublicEntryURL(name string, framework string, path string, mode string) string

func PublicMapURL

func PublicMapURL(name string, framework string, path string, mode string) string

func StoreCachedViteAsset

func StoreCachedViteAsset(built BuiltAsset)

Types

type Asset

type Asset struct {
	Name           string
	Framework      string
	Entry          string
	Path           string
	AbsPath        string
	Dev            bool
	Mode           string
	OutputDir      string
	OutputAbsDir   string
	ProjectRoot    string
	FrameworkRoot  string
	WrapperAbsPath string
}

Asset describes one client component build unit. It is intentionally independent from goxcompiler so the client builder can evolve separately.

func InstalledViteAssets

func InstalledViteAssets(assets []Asset) []Asset

func WriteFrameworkWrappers

func WriteFrameworkWrappers(assets []Asset) ([]Asset, error)

func (Asset) BuildIdentity

func (a Asset) BuildIdentity() string

func (Asset) BuildProfile

func (a Asset) BuildProfile() BuildProfile

func (Asset) EffectiveRoot

func (a Asset) EffectiveRoot() string

func (Asset) PublicBaseName

func (a Asset) PublicBaseName() string

func (Asset) PublicComponentDirName

func (a Asset) PublicComponentDirName() string

func (Asset) PublicEntryURL

func (a Asset) PublicEntryURL() string

func (Asset) PublicMapURL

func (a Asset) PublicMapURL() string

func (Asset) ViteConfigPath

func (a Asset) ViteConfigPath() string

type BuildProfile

type BuildProfile struct {
	SourceMap bool
	Minify    bool
}

type BuiltAsset

type BuiltAsset struct {
	Asset      Asset
	ConfigPath string

	EntryURL  string
	EntryFile string

	Files []BuiltClientFile
	Graph ClientDependencyGraph
}

func BuildViteAsset

func BuildViteAsset(node toolchain.NodePaths, pnpm toolchain.PNPMPaths, asset Asset) (BuiltAsset, error)

func BuildViteAssets

func BuildViteAssets(node toolchain.NodePaths, pnpm toolchain.PNPMPaths, assets []Asset) ([]BuiltAsset, error)

func TryLoadCachedViteAsset

func TryLoadCachedViteAsset(asset Asset) (BuiltAsset, bool)

type BuiltAssetKind

type BuiltAssetKind string
const (
	BuiltAssetEntry     BuiltAssetKind = "entry"
	BuiltAssetChunk     BuiltAssetKind = "chunk"
	BuiltAssetVendor    BuiltAssetKind = "vendor"
	BuiltAssetCSS       BuiltAssetKind = "css"
	BuiltAssetAsset     BuiltAssetKind = "asset"
	BuiltAssetSourceMap BuiltAssetKind = "sourcemap"
)

type BuiltClientFile

type BuiltClientFile struct {
	Kind string
	URL  string
	File string
}

func FingerprintBuiltClientEntry

func FingerprintBuiltClientEntry(asset Asset, entryPath string, files []BuiltClientFile) (string, []BuiltClientFile, error)

func ScanBuiltClientFiles

func ScanBuiltClientFiles(asset Asset, entryPath string) ([]BuiltClientFile, error)

func ScanBuiltClientGroupFiles

func ScanBuiltClientGroupFiles(asset Asset, groupOutputAbsDir string, entryPath string, outputFiles []string) ([]BuiltClientFile, error)

type ClientDependencyGraph

type ClientDependencyGraph struct {
	Entry          string                      `json:"entry"`
	EntryFile      string                      `json:"entryFile"`
	Framework      string                      `json:"framework"`
	Component      string                      `json:"component"`
	OutputFiles    []string                    `json:"outputFiles"`
	ModuleFiles    []string                    `json:"moduleFiles"`
	Imports        []string                    `json:"imports"`
	DynamicImports []string                    `json:"dynamicImports"`
	Nodes          []ClientDependencyGraphNode `json:"nodes"`
}

func ExtractClientDependencyGraphFromOutput

func ExtractClientDependencyGraphFromOutput(asset Asset, output string) (ClientDependencyGraph, error)

type ClientDependencyGraphNode

type ClientDependencyGraphNode struct {
	File           string   `json:"file"`
	Imports        []string `json:"imports"`
	DynamicImports []string `json:"dynamicImports"`
}

type FrameworkDefinition

type FrameworkDefinition struct {
	Name              string
	Dependencies      map[string]string
	DevDependencies   map[string]string
	PluginSetup       string
	PluginExprs       []string
	VendorPackages    []string
	TypeScriptOptions map[string]any
}

FrameworkDefinition contains the build behavior for a supported framework. Framework names and support states come from clientframework.

func Framework

func Framework(framework string) (FrameworkDefinition, bool)

type FrameworkImportMapEntry

type FrameworkImportMapEntry struct {
	Specifier string
	URL       string
}

func FrameworkImportMapEntries

func FrameworkImportMapEntries(framework string, version string) []FrameworkImportMapEntry

type FrameworkWorkspace

type FrameworkWorkspace struct {
	Framework       string
	RootDir         string
	PackageJSONPath string
	Changed         bool
}

func EnsureFrameworkWorkspace

func EnsureFrameworkWorkspace(projectRoot string, framework string) (FrameworkWorkspace, error)

func EnsureFrameworkWorkspaces

func EnsureFrameworkWorkspaces(projectRoot string, assets []Asset) ([]FrameworkWorkspace, error)

type RuntimeAsset

type RuntimeAsset struct {
	URL  string
	File string
}

func EnsureGoxActionsRuntime

func EnsureGoxActionsRuntime(projectRoot string) (RuntimeAsset, error)

func EnsureGoxIsleBaseStyle

func EnsureGoxIsleBaseStyle(projectRoot string) (RuntimeAsset, error)

func EnsureGoxIsleRuntime

func EnsureGoxIsleRuntime(projectRoot string) (RuntimeAsset, error)

type WrittenConfig

type WrittenConfig struct {
	Asset Asset
	Path  string
}

func WriteViteConfigs

func WriteViteConfigs(assets []Asset) ([]WrittenConfig, error)

Jump to

Keyboard shortcuts

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