Documentation
¶
Index ¶
- Constants
- Variables
- func BuildDefAssetHrefs(le *logrus.Entry, codeFiles map[string][]*ast.File, fset *token.FileSet, ...) ([]*vardef.PluginVar, error)
- func BuildDefAssets(le *logrus.Entry, codeFiles map[string][]*ast.File, fset *token.FileSet, ...) ([]*vardef.PluginVar, []string, error)
- func BuildEsbuildBundlerConfig(bundleVars []*EsbuildBundleVarMeta, ...) (*bldr_web_bundler_esbuild_compiler.Config, error)
- func BuildPackageName(pkg *types.Package) string
- func BuildViteBundlerConfig(bundleVars []*ViteBundleVarMeta, webPkgs []*bldr_web_bundler.WebPkgRefConfig, ...) (*bldr_web_bundler_vite_compiler.Config, error)
- func CodegenPluginWrapperFromAnalysis(le *logrus.Entry, a *Analysis, pluginMeta *bldr_plugin.PluginMeta, ...) (*gast.File, error)
- func CombineShellComments(tag string, comments []string) ([]string, bool, error)
- func FindTagComments[T any](tag string, fset *token.FileSet, codeFiles map[string][]*ast.File, ...) (map[string](map[string]T), error)
- func FindTagCommentsWithTypes[T any](tag string, analysis *Analysis, codeFiles map[string][]*ast.File, ...) (map[string](map[string]T), error)
- func FormatFile(gf *gast.File) ([]byte, error)
- func GetDevWrapper() (string, error)
- func NewFactory(b bus.Bus) controller.Factory
- func TrimAssetArgs(value string) (string, bool)
- func TrimAssetHrefArgs(value string) (string, bool)
- func TrimCommentArgs(tag, value string) (string, bool)
- func TrimEsbuildDirective(value string) (string, bool)
- func TrimViteDirective(value string) (string, bool)
- func UpdateRelativeGoPackagePaths(goPkgsList []string, rootModule string) ([]string, map[string]string)
- func ValidateDelveAddr(addr string) error
- type Analysis
- func (a *Analysis) AddVariableDefImports(le *logrus.Entry, varDefs []*vardef.PluginVar)
- func (a *Analysis) FindAssetHrefVariables(codeFiles map[string][]*ast.File) (map[string](map[string]*AssetHrefArgs), error)
- func (a *Analysis) FindAssetVariables(codeFiles map[string][]*ast.File) (map[string](map[string]*AssetArgs), error)
- func (a *Analysis) FindEsbuildVariables(codeFiles map[string][]*ast.File) (map[string](map[string]*EsbuildDirective), error)
- func (a *Analysis) FindViteVariables(codeFiles map[string][]*ast.File) (map[string](map[string]*ViteDirective), error)
- func (a *Analysis) GetBaseModFile() *modfile.File
- func (a *Analysis) GetFileSet() *token.FileSet
- func (a *Analysis) GetFileToken(syn *ast.File) *token.File
- func (a *Analysis) GetGoCodeFiles() map[string][]*ast.File
- func (a *Analysis) GetImportedModules() map[string]*packages.Module
- func (a *Analysis) GetLoadedPackages() map[string]*packages.Package
- func (a *Analysis) GetPackagePathMappings() map[string]string
- func (a *Analysis) GetPackagePaths() []string
- type AssetArgs
- type AssetHrefArgs
- type Config
- func (c *Config) Alloc()
- func (m *Config) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *Config) CloneVT() *Config
- func (this *Config) EqualMessageVT(thatMsg any) bool
- func (this *Config) EqualVT(that *Config) bool
- func (c *Config) EqualsConfig(other config.Config) bool
- func (c *Config) FlattenBuildTypes(filterBuildType bldr_manifest.BuildType)
- func (c *Config) FlattenPlatformTypes(buildPlatform bldr_platform.Platform)
- func (x *Config) GetBuildTypes() map[string]*Config
- func (c *Config) GetConfigID() string
- func (x *Config) GetConfigSet() map[string]*proto.ControllerConfig
- func (x *Config) GetDelveAddr() string
- func (x *Config) GetDisableRpcFetch() bool
- func (x *Config) GetEnableCgo() enabled.Enabled
- func (x *Config) GetEnableCompression() enabled.Enabled
- func (x *Config) GetEnableTinygo() enabled.Enabled
- func (x *Config) GetEsbuildFlags() []string
- func (x *Config) GetGoPkgs() []string
- func (x *Config) GetHostConfigSet() map[string]*proto.ControllerConfig
- func (x *Config) GetPlatformTypes() map[string]*Config
- func (x *Config) GetProjectId() string
- func (x *Config) GetViteConfigPaths() []string
- func (x *Config) GetViteDisableProjectConfig() bool
- func (x *Config) GetWebPkgs() []*bundler.WebPkgRefConfig
- func (x *Config) GetWebPluginId() string
- func (x *Config) MarshalJSON() ([]byte, error)
- func (x *Config) MarshalProtoJSON(s *json.MarshalState)
- func (x *Config) MarshalProtoText() string
- func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *Config) MarshalToVT(dAtA []byte) (int, error)
- func (m *Config) MarshalVT() (dAtA []byte, err error)
- func (c *Config) Merge(o *Config)
- func (c *Config) ParseEsbuildFlags() (*esbuild_api.BuildOptions, error)
- func (*Config) ProtoMessage()
- func (x *Config) Reset()
- func (m *Config) SizeVT() (n int)
- func (x *Config) String() string
- func (x *Config) UnmarshalJSON(b []byte) error
- func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *Config) UnmarshalVT(dAtA []byte) error
- func (c *Config) Validate() error
- type Config_BuildTypesEntry
- func (x *Config_BuildTypesEntry) GetKey() string
- func (x *Config_BuildTypesEntry) GetValue() *Config
- func (x *Config_BuildTypesEntry) MarshalJSON() ([]byte, error)
- func (x *Config_BuildTypesEntry) MarshalProtoJSON(s *json.MarshalState)
- func (x *Config_BuildTypesEntry) MarshalProtoText() string
- func (*Config_BuildTypesEntry) ProtoMessage()
- func (x *Config_BuildTypesEntry) Reset()
- func (x *Config_BuildTypesEntry) String() string
- func (x *Config_BuildTypesEntry) UnmarshalJSON(b []byte) error
- func (x *Config_BuildTypesEntry) UnmarshalProtoJSON(s *json.UnmarshalState)
- type Config_ConfigSetEntry
- func (x *Config_ConfigSetEntry) GetKey() string
- func (x *Config_ConfigSetEntry) GetValue() *proto.ControllerConfig
- func (x *Config_ConfigSetEntry) MarshalJSON() ([]byte, error)
- func (x *Config_ConfigSetEntry) MarshalProtoJSON(s *json.MarshalState)
- func (x *Config_ConfigSetEntry) MarshalProtoText() string
- func (*Config_ConfigSetEntry) ProtoMessage()
- func (x *Config_ConfigSetEntry) Reset()
- func (x *Config_ConfigSetEntry) String() string
- func (x *Config_ConfigSetEntry) UnmarshalJSON(b []byte) error
- func (x *Config_ConfigSetEntry) UnmarshalProtoJSON(s *json.UnmarshalState)
- type Config_HostConfigSetEntry
- func (x *Config_HostConfigSetEntry) GetKey() string
- func (x *Config_HostConfigSetEntry) GetValue() *proto.ControllerConfig
- func (x *Config_HostConfigSetEntry) MarshalJSON() ([]byte, error)
- func (x *Config_HostConfigSetEntry) MarshalProtoJSON(s *json.MarshalState)
- func (x *Config_HostConfigSetEntry) MarshalProtoText() string
- func (*Config_HostConfigSetEntry) ProtoMessage()
- func (x *Config_HostConfigSetEntry) Reset()
- func (x *Config_HostConfigSetEntry) String() string
- func (x *Config_HostConfigSetEntry) UnmarshalJSON(b []byte) error
- func (x *Config_HostConfigSetEntry) UnmarshalProtoJSON(s *json.UnmarshalState)
- type Config_PlatformTypesEntry
- func (x *Config_PlatformTypesEntry) GetKey() string
- func (x *Config_PlatformTypesEntry) GetValue() *Config
- func (x *Config_PlatformTypesEntry) MarshalJSON() ([]byte, error)
- func (x *Config_PlatformTypesEntry) MarshalProtoJSON(s *json.MarshalState)
- func (x *Config_PlatformTypesEntry) MarshalProtoText() string
- func (*Config_PlatformTypesEntry) ProtoMessage()
- func (x *Config_PlatformTypesEntry) Reset()
- func (x *Config_PlatformTypesEntry) String() string
- func (x *Config_PlatformTypesEntry) UnmarshalJSON(b []byte) error
- func (x *Config_PlatformTypesEntry) UnmarshalProtoJSON(s *json.UnmarshalState)
- type Controller
- func (c *Controller) AddPreBuildHook(hook PreBuildHook)
- func (c *Controller) BuildManifest(ctx context.Context, args *bldr_manifest_builder.BuildManifestArgs, ...) (*bldr_manifest_builder.BuilderResult, error)
- func (c *Controller) BuildPlugin(ctx context.Context, le *logrus.Entry, pluginMeta *bldr_plugin.PluginMeta, ...) (*Analysis, *bldr_manifest_builder.InputManifest, error)
- func (c *Controller) Execute(ctx context.Context) error
- func (c *Controller) FastRebuildPlugin(ctx context.Context, le *logrus.Entry, ...) (*bldr_manifest_builder.InputManifest, error)
- func (c *Controller) GetSupportedPlatforms() []string
- func (c *Controller) SupportsStartupManifestCache() bool
- type EsbuildBundleVarMeta
- func (m *EsbuildBundleVarMeta) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *EsbuildBundleVarMeta) CloneVT() *EsbuildBundleVarMeta
- func (this *EsbuildBundleVarMeta) EqualMessageVT(thatMsg any) bool
- func (this *EsbuildBundleVarMeta) EqualVT(that *EsbuildBundleVarMeta) bool
- func (x *EsbuildBundleVarMeta) GetEntrypointVars() []*EsbuildEntrypointVar
- func (x *EsbuildBundleVarMeta) GetId() string
- func (x *EsbuildBundleVarMeta) MarshalJSON() ([]byte, error)
- func (x *EsbuildBundleVarMeta) MarshalProtoJSON(s *json.MarshalState)
- func (x *EsbuildBundleVarMeta) MarshalProtoText() string
- func (m *EsbuildBundleVarMeta) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *EsbuildBundleVarMeta) MarshalToVT(dAtA []byte) (int, error)
- func (m *EsbuildBundleVarMeta) MarshalVT() (dAtA []byte, err error)
- func (*EsbuildBundleVarMeta) ProtoMessage()
- func (x *EsbuildBundleVarMeta) Reset()
- func (m *EsbuildBundleVarMeta) SizeVT() (n int)
- func (m *EsbuildBundleVarMeta) SortEntrypointVars()
- func (x *EsbuildBundleVarMeta) String() string
- func (x *EsbuildBundleVarMeta) UnmarshalJSON(b []byte) error
- func (x *EsbuildBundleVarMeta) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *EsbuildBundleVarMeta) UnmarshalVT(dAtA []byte) error
- type EsbuildDirective
- type EsbuildEntrypointVar
- func (m *EsbuildEntrypointVar) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *EsbuildEntrypointVar) CloneVT() *EsbuildEntrypointVar
- func (this *EsbuildEntrypointVar) EqualMessageVT(thatMsg any) bool
- func (this *EsbuildEntrypointVar) EqualVT(that *EsbuildEntrypointVar) bool
- func (x *EsbuildEntrypointVar) GetEsbuildFlags() []string
- func (x *EsbuildEntrypointVar) GetPkgCodePath() string
- func (x *EsbuildEntrypointVar) GetPkgImportPath() string
- func (x *EsbuildEntrypointVar) GetPkgVar() string
- func (x *EsbuildEntrypointVar) GetPkgVarType() EsbuildVarType
- func (x *EsbuildEntrypointVar) MarshalJSON() ([]byte, error)
- func (x *EsbuildEntrypointVar) MarshalProtoJSON(s *json.MarshalState)
- func (x *EsbuildEntrypointVar) MarshalProtoText() string
- func (m *EsbuildEntrypointVar) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *EsbuildEntrypointVar) MarshalToVT(dAtA []byte) (int, error)
- func (m *EsbuildEntrypointVar) MarshalVT() (dAtA []byte, err error)
- func (*EsbuildEntrypointVar) ProtoMessage()
- func (x *EsbuildEntrypointVar) Reset()
- func (m *EsbuildEntrypointVar) SizeVT() (n int)
- func (x *EsbuildEntrypointVar) String() string
- func (m *EsbuildEntrypointVar) ToEsbuildEntrypointId(bundleID string) string
- func (x *EsbuildEntrypointVar) UnmarshalJSON(b []byte) error
- func (x *EsbuildEntrypointVar) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *EsbuildEntrypointVar) UnmarshalVT(dAtA []byte) error
- type EsbuildVarType
- func (x EsbuildVarType) Enum() *EsbuildVarType
- func (x EsbuildVarType) MarshalJSON() ([]byte, error)
- func (x EsbuildVarType) MarshalProtoJSON(s *json.MarshalState)
- func (x EsbuildVarType) MarshalProtoText() string
- func (x EsbuildVarType) MarshalText() ([]byte, error)
- func (x EsbuildVarType) String() string
- func (x *EsbuildVarType) UnmarshalJSON(b []byte) error
- func (x *EsbuildVarType) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (x *EsbuildVarType) UnmarshalText(b []byte) error
- type Factory
- type InputFileKind
- func (x InputFileKind) Enum() *InputFileKind
- func (x InputFileKind) MarshalJSON() ([]byte, error)
- func (x InputFileKind) MarshalProtoJSON(s *json.MarshalState)
- func (x InputFileKind) MarshalProtoText() string
- func (x InputFileKind) MarshalText() ([]byte, error)
- func (x InputFileKind) String() string
- func (x *InputFileKind) UnmarshalJSON(b []byte) error
- func (x *InputFileKind) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (x *InputFileKind) UnmarshalText(b []byte) error
- type InputFileMeta
- func (m *InputFileMeta) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *InputFileMeta) CloneVT() *InputFileMeta
- func (this *InputFileMeta) EqualMessageVT(thatMsg any) bool
- func (this *InputFileMeta) EqualVT(that *InputFileMeta) bool
- func (x *InputFileMeta) GetKind() InputFileKind
- func (x *InputFileMeta) MarshalJSON() ([]byte, error)
- func (x *InputFileMeta) MarshalProtoJSON(s *json.MarshalState)
- func (x *InputFileMeta) MarshalProtoText() string
- func (m *InputFileMeta) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *InputFileMeta) MarshalToVT(dAtA []byte) (int, error)
- func (m *InputFileMeta) MarshalVT() (dAtA []byte, err error)
- func (*InputFileMeta) ProtoMessage()
- func (x *InputFileMeta) Reset()
- func (m *InputFileMeta) SizeVT() (n int)
- func (x *InputFileMeta) String() string
- func (x *InputFileMeta) UnmarshalJSON(b []byte) error
- func (x *InputFileMeta) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *InputFileMeta) UnmarshalVT(dAtA []byte) error
- type InputManifestMeta
- func (m *InputManifestMeta) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *InputManifestMeta) CloneVT() *InputManifestMeta
- func (this *InputManifestMeta) EqualMessageVT(thatMsg any) bool
- func (this *InputManifestMeta) EqualVT(that *InputManifestMeta) bool
- func (x *InputManifestMeta) GetDevInfo() *vardef.PluginDevInfo
- func (x *InputManifestMeta) GetEsbuildBundles() []*EsbuildBundleVarMeta
- func (x *InputManifestMeta) GetEsbuildFlags() []string
- func (x *InputManifestMeta) GetEsbuildOutputs() []*esbuild.EsbuildOutputMeta
- func (x *InputManifestMeta) GetViteBundles() []*ViteBundleVarMeta
- func (x *InputManifestMeta) GetViteConfigPaths() []string
- func (x *InputManifestMeta) GetViteDisableProjectConfig() bool
- func (x *InputManifestMeta) GetViteOutputs() []*vite.ViteOutputMeta
- func (x *InputManifestMeta) GetWebPkgRefs() []*pkg.WebPkgRef
- func (x *InputManifestMeta) GetWebPkgs() []*bundler.WebPkgRefConfig
- func (x *InputManifestMeta) MarshalJSON() ([]byte, error)
- func (x *InputManifestMeta) MarshalProtoJSON(s *json.MarshalState)
- func (x *InputManifestMeta) MarshalProtoText() string
- func (m *InputManifestMeta) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *InputManifestMeta) MarshalToVT(dAtA []byte) (int, error)
- func (m *InputManifestMeta) MarshalVT() (dAtA []byte, err error)
- func (*InputManifestMeta) ProtoMessage()
- func (x *InputManifestMeta) Reset()
- func (m *InputManifestMeta) SizeVT() (n int)
- func (x *InputManifestMeta) String() string
- func (x *InputManifestMeta) UnmarshalJSON(b []byte) error
- func (x *InputManifestMeta) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *InputManifestMeta) UnmarshalVT(dAtA []byte) error
- type ModuleCompiler
- func (m *ModuleCompiler) CompilePlugin(ctx context.Context, le *logrus.Entry, outFile string, ...) error
- func (m *ModuleCompiler) CompilePluginDevWrapper(ctx context.Context, le *logrus.Entry, outFile, dlvAddr string, ...) error
- func (m *ModuleCompiler) GenerateModule(analysis *Analysis, pluginMeta *bldr_plugin.PluginMeta, configSetBinary []byte, ...) (*vardef.PluginDevInfo, error)
- type PreBuildHook
- type PreBuildHookResult
- func (m *PreBuildHookResult) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *PreBuildHookResult) CloneVT() *PreBuildHookResult
- func (this *PreBuildHookResult) EqualMessageVT(thatMsg any) bool
- func (this *PreBuildHookResult) EqualVT(that *PreBuildHookResult) bool
- func (x *PreBuildHookResult) GetConfig() *Config
- func (x *PreBuildHookResult) MarshalJSON() ([]byte, error)
- func (x *PreBuildHookResult) MarshalProtoJSON(s *json.MarshalState)
- func (x *PreBuildHookResult) MarshalProtoText() string
- func (m *PreBuildHookResult) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *PreBuildHookResult) MarshalToVT(dAtA []byte) (int, error)
- func (m *PreBuildHookResult) MarshalVT() (dAtA []byte, err error)
- func (*PreBuildHookResult) ProtoMessage()
- func (x *PreBuildHookResult) Reset()
- func (m *PreBuildHookResult) SizeVT() (n int)
- func (x *PreBuildHookResult) String() string
- func (x *PreBuildHookResult) UnmarshalJSON(b []byte) error
- func (x *PreBuildHookResult) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *PreBuildHookResult) UnmarshalVT(dAtA []byte) error
- type ViteBundleVarMeta
- func (m *ViteBundleVarMeta) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *ViteBundleVarMeta) CloneVT() *ViteBundleVarMeta
- func (this *ViteBundleVarMeta) EqualMessageVT(thatMsg any) bool
- func (this *ViteBundleVarMeta) EqualVT(that *ViteBundleVarMeta) bool
- func (x *ViteBundleVarMeta) GetEntrypointVars() []*ViteEntrypointVar
- func (x *ViteBundleVarMeta) GetId() string
- func (x *ViteBundleVarMeta) MarshalJSON() ([]byte, error)
- func (x *ViteBundleVarMeta) MarshalProtoJSON(s *json.MarshalState)
- func (x *ViteBundleVarMeta) MarshalProtoText() string
- func (m *ViteBundleVarMeta) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *ViteBundleVarMeta) MarshalToVT(dAtA []byte) (int, error)
- func (m *ViteBundleVarMeta) MarshalVT() (dAtA []byte, err error)
- func (*ViteBundleVarMeta) ProtoMessage()
- func (x *ViteBundleVarMeta) Reset()
- func (m *ViteBundleVarMeta) SizeVT() (n int)
- func (m *ViteBundleVarMeta) SortEntrypointVars()
- func (x *ViteBundleVarMeta) String() string
- func (x *ViteBundleVarMeta) UnmarshalJSON(b []byte) error
- func (x *ViteBundleVarMeta) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *ViteBundleVarMeta) UnmarshalVT(dAtA []byte) error
- type ViteDirective
- type ViteDirectiveArgs
- type ViteEntrypointVar
- func (m *ViteEntrypointVar) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *ViteEntrypointVar) CloneVT() *ViteEntrypointVar
- func (this *ViteEntrypointVar) EqualMessageVT(thatMsg any) bool
- func (this *ViteEntrypointVar) EqualVT(that *ViteEntrypointVar) bool
- func (x *ViteEntrypointVar) GetDisableProjectConfig() bool
- func (x *ViteEntrypointVar) GetEntrypointPath() string
- func (x *ViteEntrypointVar) GetPkgCodePath() string
- func (x *ViteEntrypointVar) GetPkgImportPath() string
- func (x *ViteEntrypointVar) GetPkgVar() string
- func (x *ViteEntrypointVar) GetPkgVarType() ViteVarType
- func (x *ViteEntrypointVar) GetViteConfigPaths() []string
- func (x *ViteEntrypointVar) MarshalJSON() ([]byte, error)
- func (x *ViteEntrypointVar) MarshalProtoJSON(s *json.MarshalState)
- func (x *ViteEntrypointVar) MarshalProtoText() string
- func (m *ViteEntrypointVar) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *ViteEntrypointVar) MarshalToVT(dAtA []byte) (int, error)
- func (m *ViteEntrypointVar) MarshalVT() (dAtA []byte, err error)
- func (*ViteEntrypointVar) ProtoMessage()
- func (x *ViteEntrypointVar) Reset()
- func (m *ViteEntrypointVar) SizeVT() (n int)
- func (x *ViteEntrypointVar) String() string
- func (x *ViteEntrypointVar) UnmarshalJSON(b []byte) error
- func (x *ViteEntrypointVar) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *ViteEntrypointVar) UnmarshalVT(dAtA []byte) error
- type ViteVarType
- func (x ViteVarType) Enum() *ViteVarType
- func (x ViteVarType) MarshalJSON() ([]byte, error)
- func (x ViteVarType) MarshalProtoJSON(s *json.MarshalState)
- func (x ViteVarType) MarshalProtoText() string
- func (x ViteVarType) MarshalText() ([]byte, error)
- func (x ViteVarType) String() string
- func (x *ViteVarType) UnmarshalJSON(b []byte) error
- func (x *ViteVarType) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (x *ViteVarType) UnmarshalText(b []byte) error
Constants ¶
const AssetHrefTag = "bldr:asset:href"
AssetHrefTag is the comment tag used for getting paths to assets.
const AssetTag = "bldr:asset"
AssetTag is the comment tag used for assets.
const BundleIDFlag = "--bundle-id="
BundleIDFlag is the flag for bundle-id.
const ConfigID = "bldr/plugin/compiler/go"
ConfigID is the config identifier.
const ControllerID = ConfigID
ControllerID is the compiler controller ID.
const DefaultBundleID = "default"
DefaultBundleID is the default ID to use for esbuild bundles.
const DefaultViteBundleID = "default"
DefaultViteBundleID is the default ID to use for vite bundles.
const EsbuildOutputPkgPath = "github.com/s4wave/spacewave/bldr/web/bundler"
EsbuildOutputPkgPath is the package path for EsbuildOutput type
const EsbuildOutputTypeName = "WebBundlerOutput"
EsbuildOutputTypeName is the type name for EsbuildOutput
const EsbuildTag = "bldr:esbuild"
EsbuildTag is the comment tag used for esbuild.
const ViteBundleIDFlag = "--bundle-id="
ViteBundleIDFlag is the flag for bundle-id.
const ViteConfigFlag = "--config="
ViteConfigFlag is the flag for vite config paths.
const ViteDisableProjectConfigFlag = "--disable-project-config"
ViteDisableProjectConfigFlag is the flag to disable automatic project config detection.
const ViteTag = "bldr:vite"
ViteTag is the comment tag used for vite.
Variables ¶
var ( InputFileKind_name = map[int32]string{ 0: "InputFileKind_UNKNOWN", 1: "InputFileKind_ASSET", 2: "InputFileKind_GO", } InputFileKind_value = map[string]int32{ "InputFileKind_UNKNOWN": 0, "InputFileKind_ASSET": 1, "InputFileKind_GO": 2, } )
Enum value maps for InputFileKind.
var ( EsbuildVarType_name = map[int32]string{ 0: "EsbuildVarType_ENTRYPOINT_PATH", 1: "EsbuildVarType_WEB_BUNDLER_OUTPUT", } EsbuildVarType_value = map[string]int32{ "EsbuildVarType_ENTRYPOINT_PATH": 0, "EsbuildVarType_WEB_BUNDLER_OUTPUT": 1, } )
Enum value maps for EsbuildVarType.
var ( ViteVarType_name = map[int32]string{ 0: "ViteVarType_ENTRYPOINT_PATH", 1: "ViteVarType_WEB_BUNDLER_OUTPUT", } ViteVarType_value = map[string]int32{ "ViteVarType_ENTRYPOINT_PATH": 0, "ViteVarType_WEB_BUNDLER_OUTPUT": 1, } )
Enum value maps for ViteVarType.
var DevWrapperFs embed.FS
DevWrapperFs contains the dev wrapper go code.
var ErrUnexpectedVarType = errors.New("unexpected variable type for build directive")
ErrUnexpectedVarType is returned when a variable has an unexpected type.
var Version = semver.MustParse("0.0.1")
Version is the controller version
Functions ¶
func BuildDefAssetHrefs ¶
func BuildDefAssetHrefs( le *logrus.Entry, codeFiles map[string][]*ast.File, fset *token.FileSet, pkgs map[string](map[string]*AssetHrefArgs), outAssetsPath string, pluginID string, isRelease bool, ) ([]*vardef.PluginVar, error)
BuildDefAssetHrefs builds the list of go variable defs for the given code files. This processes variables marked with bldr:asset:href comments to generate URLs to assets. Unlike BuildDefAssets, this doesn't copy files but just creates references to existing assets.
func BuildDefAssets ¶
func BuildDefAssets( le *logrus.Entry, codeFiles map[string][]*ast.File, fset *token.FileSet, pkgs map[string](map[string]*AssetArgs), outAssetsPath string, pluginID string, isRelease bool, ) ([]*vardef.PluginVar, []string, error)
BuildDefAssets builds the list of go variable defs for the given code files.
func BuildEsbuildBundlerConfig ¶
func BuildEsbuildBundlerConfig( bundleVars []*EsbuildBundleVarMeta, webPkgs []*bldr_web_bundler.WebPkgRefConfig, baseEsbuildFlags []string, codeRootPath, publicPath string, ) (*bldr_web_bundler_esbuild_compiler.Config, error)
BuildEsbuildBundlerConfig builds the esbuild bundler controller config.
func BuildPackageName ¶
BuildPackageName builds the unique name for the package.
func BuildViteBundlerConfig ¶
func BuildViteBundlerConfig( bundleVars []*ViteBundleVarMeta, webPkgs []*bldr_web_bundler.WebPkgRefConfig, viteConfigPaths []string, publicPath string, disableProjectConfig bool, ) (*bldr_web_bundler_vite_compiler.Config, error)
BuildViteBundlerConfig builds the vite bundler controller config.
func CodegenPluginWrapperFromAnalysis ¶
func CodegenPluginWrapperFromAnalysis( le *logrus.Entry, a *Analysis, pluginMeta *bldr_plugin.PluginMeta, configSetFiles []string, goVarDefs []*vardef.PluginVar, devInfoFile string, ) (*gast.File, error)
CodegenPluginWrapperFromAnalysis codegens a plugin wrapper from analysis.
configSetFiles will be embedded in the binary and parsed as a ConfigSet.
devInfoFile will be loaded at runtime and used to populate variables init(). if devInfoFile is empty, the values of the go variable defs are hardcoded into init().
func CombineShellComments ¶
CombineShellComments searches for & strips the given tag from the list of comments. Parses each comment as shell args (splits with shell quote rules). Returns the merged list of shell args. Returns if the tag was found in any of the comments. Ignores any comments without the prefix. This allows for multi-line shell-style arguments in comments to be combined.
func FindTagComments ¶
func FindTagComments[T any]( tag string, fset *token.FileSet, codeFiles map[string][]*ast.File, checkParseComments func(values []string, spec *ast.ValueSpec) (T, bool, error), ) (map[string](map[string]T), error)
FindTagComments searches for comments associated with variable declarations (`var`) that have the given tag prefix. It operates purely on the Abstract Syntax Tree (AST) and does not use resolved type information.
Returns a map of packages -> variable names -> parsed result (type T). The checkParseComments callback receives the comment lines and the AST node (*ast.ValueSpec) for the variable declaration. It should return the parsed result, a boolean indicating if the tag was found, and any error. Returning false for the boolean skips the comment.
func FindTagCommentsWithTypes ¶
func FindTagCommentsWithTypes[T any]( tag string, analysis *Analysis, codeFiles map[string][]*ast.File, processComments func( values []string, varName string, pkg *packages.Package, obj types.Object, ) (T, bool, error), ) (map[string](map[string]T), error)
FindTagCommentsWithTypes searches for comments associated with variable declarations (`var`) that have the given tag prefix. It uses resolved type information from the provided Analysis object in addition to the Abstract Syntax Tree (AST).
Returns a map of packages -> variable names -> parsed result (type T). The processComments callback receives the comment lines, the variable name, the package containing the variable (*packages.Package), and the resolved type object (types.Object). It should return the parsed result, a boolean indicating if the tag was found, and any error. Returning false for the boolean skips the comment. This allows the callback to make decisions based on the variable's actual type.
func FormatFile ¶
FormatFile formats the output file.
func GetDevWrapper ¶
GetDevWrapper is a Go program to launch the plugin in dev mode.
func NewFactory ¶
func NewFactory(b bus.Bus) controller.Factory
NewFactory constructs a new plugin compiler controller factory.
func TrimAssetArgs ¶
TrimAssetArgs trims the bldr:asset prefix from a string. Returns if the string had the prefix.
func TrimAssetHrefArgs ¶
TrimAssetHrefArgs trims the bldr:asset prefix from a string. Returns if the string had the prefix.
func TrimCommentArgs ¶
TrimCommentArgs trims a comment tag prefix from a string.
Returns if the string had the comment tag prefix.
func TrimEsbuildDirective ¶
TrimEsbuildDirective trims the bldr:esbuild prefix from a string. Returns if the string had the prefix.
func TrimViteDirective ¶
TrimViteDirective trims the bldr:vite prefix from a string. Returns if the string had the prefix.
func UpdateRelativeGoPackagePaths ¶
func UpdateRelativeGoPackagePaths(goPkgsList []string, rootModule string) ([]string, map[string]string)
UpdateRelativeGoPackagePaths applies the root module path to the go_packages list. Returns the updated packages list and the mappings from goPkg to goPkgName.
Types ¶
type Analysis ¶
type Analysis struct {
// contains filtered or unexported fields
}
Analysis contains the result of code analysis.
func AnalyzePackages ¶
func AnalyzePackages( ctx context.Context, le *logrus.Entry, workDir string, packagePaths []string, buildTags []string, goos, goarch string, ) (*Analysis, error)
AnalyzePackages analyzes code packages using Go module package resolution.
packagePaths can start with ./ to be relative to the root module path.
goos and goarch select the build environment used to evaluate per-file build tags during analysis. Pass the target platform's GOOS/GOARCH so factories gated on platform-specific tags (e.g. "//go:build !js") match the target compile rather than the analysis host. Empty strings fall back to linux/amd64.
func (*Analysis) AddVariableDefImports ¶
AddVariableDefImports adds imports for the given variable defs.
func (*Analysis) FindAssetHrefVariables ¶
func (a *Analysis) FindAssetHrefVariables(codeFiles map[string][]*ast.File) (map[string](map[string]*AssetHrefArgs), error)
FindAssetHrefVariables searches for bldr:asset:href comments.
func (*Analysis) FindAssetVariables ¶
func (a *Analysis) FindAssetVariables(codeFiles map[string][]*ast.File) (map[string](map[string]*AssetArgs), error)
FindAssetVariables searches for bldr:asset comments.
func (*Analysis) FindEsbuildVariables ¶
func (a *Analysis) FindEsbuildVariables(codeFiles map[string][]*ast.File) (map[string](map[string]*EsbuildDirective), error)
FindEsbuildVariables searches for bldr:esbuild comments.
func (*Analysis) FindViteVariables ¶
func (a *Analysis) FindViteVariables(codeFiles map[string][]*ast.File) (map[string](map[string]*ViteDirective), error)
FindViteVariables searches for bldr:vite comments.
func (*Analysis) GetBaseModFile ¶
GetBaseModFile returns the parsed ModFile from the working dir.
func (*Analysis) GetFileSet ¶
GetFileSet returns the token file set.
func (*Analysis) GetFileToken ¶
GetFileToken returns the file corresponding to the syntax object.
func (*Analysis) GetGoCodeFiles ¶
GetGoCodeFiles returns file paths for packages in the program.
func (*Analysis) GetImportedModules ¶
GetImportedModules returns the list of modules imported in the packages.
func (*Analysis) GetLoadedPackages ¶
GetLoadedPackages returns the loaded packages.
func (*Analysis) GetPackagePathMappings ¶
GetPackagePathMappings returns the mappings from the provided go pkg path to the resolved one.
func (*Analysis) GetPackagePaths ¶
GetPackagePaths returns the resolved root package paths.
type AssetArgs ¶
type AssetArgs struct {
// FromPath is the relative path to the from file or dir.
FromPath string
// ToPath is the relative path to the location in the assets fs.
ToPath string
}
AssetArgs are arguments parsed from a bldr:asset directive.
func ParseAssetComments ¶
ParseAssetComments parses the bldr:asset comments for a variable.
If no bldr:asset prefix is found, returns nil, false, nil
func (*AssetArgs) BuildFlagSet ¶
BuildFlagSet builds the set of flags for the args.
type AssetHrefArgs ¶
type AssetHrefArgs struct {
// AssetPath is the relative path to the location in the assets fs.
AssetPath string
}
AssetHrefArgs are arguments parsed from a bldr:asset:href directive.
func ParseAssetHrefComments ¶
ParseAssetHrefComments parses the bldr:asset:ref comments for a variable.
If no bldr:asset:href prefix is found, returns nil, false, nil
func (*AssetHrefArgs) BuildFlagSet ¶
func (a *AssetHrefArgs) BuildFlagSet() *flag.FlagSet
BuildFlagSet builds the set of flags for the args.
type Config ¶
type Config struct {
// ProjectId overrides the project id set in the project config.
ProjectId string `protobuf:"bytes,1,opt,name=project_id,json=projectId,proto3" json:"projectId,omitempty"`
// ConfigSet is a ConfigSet to apply on plugin startup.
// This ConfigSet is applied to the plugin bus.
// This will be included in the plugin binary.
// Merged with the plugin compiler ConfigSet field.
ConfigSet map[string]*proto.ControllerConfig `` /* 175-byte string literal not displayed */
// HostConfigSet is a ConfigSet to apply to the host on plugin startup.
// This ConfigSet is applied to the plugin host bus.
// This will be included in the plugin binary.
// Adds a config to configSet with ID bldr/plugin/host/configset
// Merged with the plugin compiler HostConfigSet field.
HostConfigSet map[string]*proto.ControllerConfig `` /* 188-byte string literal not displayed */
// GoPkgs is a list of Go packages to scan for controller factories.
// Looks for package-level functions:
// - NewFactory(b bus.Bus) controller.Factory
// - BuildFactories(b bus.Bus) []controller.Factory
//
// Appended to the list set in the plugin compiler settings.
GoPkgs []string `protobuf:"bytes,4,rep,name=go_pkgs,json=goPkgs,proto3" json:"goPkgs,omitempty"`
// WebPkgs is the list of web packages to externalize and include in the bundle.
//
// Externalized web packages (npm modules) are imported separately from the web bundle.
// They will be deduplicated such that a single version is imported at a time by the app.
// This is useful for packages that require a single instance per WebDocument.
//
// On default only the imports referenced by the plugin will be compiled in.
// Everything else will be tree-shaken away to lower bundle size.
// Additional imports to reference can be specified in the config.
//
// These packages will be available with the LookupWebPkg directive.
// They will also be available at /b/pkg: e.g. /b/pkg/@my/npm-package/foo/bar/index.js
//
// Note: only files & entrypoints imported by at least one js file will be included.
WebPkgs []*bundler.WebPkgRefConfig `protobuf:"bytes,5,rep,name=web_pkgs,json=webPkgs,proto3" json:"webPkgs,omitempty"`
// ViteConfigPaths is a list of paths to Vite configuration files to apply to all bundles.
// Ignored unless any bldr:vite directives are found in the code.
ViteConfigPaths []string `protobuf:"bytes,15,rep,name=vite_config_paths,json=viteConfigPaths,proto3" json:"viteConfigPaths,omitempty"`
// ViteDisableProjectConfig indicates whether to disable automatic project config detection for Vite.
// Disables finding the root vite.conf.ts for the project.
// Ignored unless any bldr:vite directives are found in the code.
ViteDisableProjectConfig bool `` /* 136-byte string literal not displayed */
// DisableRpcFetch disables the default Fetch RPC service handler.
// The handler handles the Fetch service by creating a directive.
// You can also override config ID "rpc-fetch" in the config-set.
// This service is used for the ServiceWorker HTTP calls.
DisableRpcFetch bool `protobuf:"varint,6,opt,name=disable_rpc_fetch,json=disableRpcFetch,proto3" json:"disableRpcFetch,omitempty"`
// DelveAddr is the address to listen for Delve remote connections.
// If the build mode is dev and this is set, uses delve to run the plugin.
// Ignored if build mode is not dev.
// Allowed characters: [Z-a0-9.:]
// Special value: "wait" - waits for plugin entrypoint to be run manually.
// Example: ":5000"
DelveAddr string `protobuf:"bytes,8,opt,name=delve_addr,json=delveAddr,proto3" json:"delveAddr,omitempty"`
// EnableCgo enables cgo in the Go compiler.
//
// Cgo is disabled by default as it may cause non-reproducible builds.
// https://github.com/golang/go/issues/57120#issuecomment-1420752516
//
// Cgo may still be force-disabled if incompatible with the target (wasm, tinygo).
EnableCgo enabled.Enabled `protobuf:"varint,9,opt,name=enable_cgo,json=enableCgo,proto3" json:"enableCgo,omitempty"`
// EnableTinygo enables using TinyGo instead of the Go compiler in some circumstances.
// The default is to use tinygo for the web platform in release mode.
// Only applicable for the web platform (WebAssembly) (currently).
EnableTinygo enabled.Enabled `protobuf:"varint,10,opt,name=enable_tinygo,json=enableTinygo,proto3" json:"enableTinygo,omitempty"`
// EnableCompression can optionally force-enable or force-disable binary compression.
// The default is ENABLE for release-mode only.
// Only applicable for the web platform (WebAssembly) (currently).
EnableCompression enabled.Enabled `protobuf:"varint,11,opt,name=enable_compression,json=enableCompression,proto3" json:"enableCompression,omitempty"`
// EsbuildFlags is a string containing additional flags to pass to esbuild.
// Flags passed by bldr:esbuild directives can override these values.
// E.x.: --target es2020
EsbuildFlags []string `protobuf:"bytes,12,rep,name=esbuild_flags,json=esbuildFlags,proto3" json:"esbuildFlags,omitempty"`
// WebPluginId sets the plugin id for the web plugin.
// If set, the compiler automatically adds these controllers to the config set:
// - handle-web-pkgs: handle web pkg lookups for the webPkgIds if there are any webPkgs defined
// - handle-web-view-rpc: handle incoming RPCs for web-view
// - handle-web-view-server: handle incoming RPCs for HandleWebView
// - handle-web-view: handle web views via HandleWebView
// - load-web: loads the web plugin on startup
// - observe-web-view: handle LookupWebView with incoming HandleWebView directives
WebPluginId string `protobuf:"bytes,13,opt,name=web_plugin_id,json=webPluginId,proto3" json:"webPluginId,omitempty"`
// BuildTypes contains a mapping of BuildType to Config override.
BuildTypes map[string]*Config `` /* 179-byte string literal not displayed */
// PlatformTypes contains a mapping of platform ID to Config override.
// Keys are platform IDs (e.g., "desktop", "js", "none", "desktop/linux/amd64").
// Both base platform IDs and full platform IDs are checked: a build for
// "desktop/darwin/arm64" will match both "desktop/darwin/arm64" and "desktop".
PlatformTypes map[string]*Config `` /* 188-byte string literal not displayed */
// contains filtered or unexported fields
}
Config configures the Go plugin compiler controller.
func (*Config) CloneMessageVT ¶
func (m *Config) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*Config) EqualMessageVT ¶
func (*Config) EqualsConfig ¶
EqualsConfig checks if the config is equal to another.
func (*Config) FlattenBuildTypes ¶
func (c *Config) FlattenBuildTypes(filterBuildType bldr_manifest.BuildType)
FlattenBuildTypes flattens the build_type tree given the current build type.
Clears the BuildTypes field and applies all relevant BuildType overrides to c.
func (*Config) FlattenPlatformTypes ¶
func (c *Config) FlattenPlatformTypes(buildPlatform bldr_platform.Platform)
FlattenPlatformTypes flattens the platform_types tree given the current build platform.
Checks both the full platform ID (e.g., "desktop/darwin/arm64") and the base platform ID (e.g., "desktop"). Full ID match is applied first, then base ID. Clears the PlatformTypes field and applies all relevant overrides to c.
func (*Config) GetBuildTypes ¶
func (*Config) GetConfigID ¶
GetConfigID returns the unique string for this configuration type.
func (*Config) GetConfigSet ¶
func (x *Config) GetConfigSet() map[string]*proto.ControllerConfig
func (*Config) GetDelveAddr ¶
func (*Config) GetDisableRpcFetch ¶
func (*Config) GetEnableCgo ¶
func (*Config) GetEnableCompression ¶
func (*Config) GetEnableTinygo ¶
func (*Config) GetEsbuildFlags ¶
func (*Config) GetHostConfigSet ¶
func (x *Config) GetHostConfigSet() map[string]*proto.ControllerConfig
func (*Config) GetPlatformTypes ¶
func (*Config) GetProjectId ¶
func (*Config) GetViteConfigPaths ¶
func (*Config) GetViteDisableProjectConfig ¶
func (*Config) GetWebPkgs ¶
func (x *Config) GetWebPkgs() []*bundler.WebPkgRefConfig
func (*Config) GetWebPluginId ¶
func (*Config) MarshalJSON ¶
MarshalJSON marshals the Config to JSON.
func (*Config) MarshalProtoJSON ¶
func (x *Config) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the Config message to JSON.
func (*Config) MarshalProtoText ¶
func (*Config) MarshalToSizedBufferVT ¶
func (*Config) ParseEsbuildFlags ¶
func (c *Config) ParseEsbuildFlags() (*esbuild_api.BuildOptions, error)
ParseEsbuildFlags parsed the esbuild flags field, if set. Returns nil if no flags were set.
func (*Config) ProtoMessage ¶
func (*Config) ProtoMessage()
func (*Config) UnmarshalJSON ¶
UnmarshalJSON unmarshals the Config from JSON.
func (*Config) UnmarshalProtoJSON ¶
func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the Config message from JSON.
func (*Config) UnmarshalVT ¶
type Config_BuildTypesEntry ¶
type Config_BuildTypesEntry struct {
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
Value *Config `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
// contains filtered or unexported fields
}
func (*Config_BuildTypesEntry) GetKey ¶
func (x *Config_BuildTypesEntry) GetKey() string
func (*Config_BuildTypesEntry) GetValue ¶
func (x *Config_BuildTypesEntry) GetValue() *Config
func (*Config_BuildTypesEntry) MarshalJSON ¶
func (x *Config_BuildTypesEntry) MarshalJSON() ([]byte, error)
MarshalJSON marshals the Config_BuildTypesEntry to JSON.
func (*Config_BuildTypesEntry) MarshalProtoJSON ¶
func (x *Config_BuildTypesEntry) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the Config_BuildTypesEntry message to JSON.
func (*Config_BuildTypesEntry) MarshalProtoText ¶
func (x *Config_BuildTypesEntry) MarshalProtoText() string
func (*Config_BuildTypesEntry) ProtoMessage ¶
func (*Config_BuildTypesEntry) ProtoMessage()
func (*Config_BuildTypesEntry) Reset ¶
func (x *Config_BuildTypesEntry) Reset()
func (*Config_BuildTypesEntry) String ¶
func (x *Config_BuildTypesEntry) String() string
func (*Config_BuildTypesEntry) UnmarshalJSON ¶
func (x *Config_BuildTypesEntry) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the Config_BuildTypesEntry from JSON.
func (*Config_BuildTypesEntry) UnmarshalProtoJSON ¶
func (x *Config_BuildTypesEntry) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the Config_BuildTypesEntry message from JSON.
type Config_ConfigSetEntry ¶
type Config_ConfigSetEntry struct {
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
Value *proto.ControllerConfig `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
// contains filtered or unexported fields
}
func (*Config_ConfigSetEntry) GetKey ¶
func (x *Config_ConfigSetEntry) GetKey() string
func (*Config_ConfigSetEntry) GetValue ¶
func (x *Config_ConfigSetEntry) GetValue() *proto.ControllerConfig
func (*Config_ConfigSetEntry) MarshalJSON ¶
func (x *Config_ConfigSetEntry) MarshalJSON() ([]byte, error)
MarshalJSON marshals the Config_ConfigSetEntry to JSON.
func (*Config_ConfigSetEntry) MarshalProtoJSON ¶
func (x *Config_ConfigSetEntry) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the Config_ConfigSetEntry message to JSON.
func (*Config_ConfigSetEntry) MarshalProtoText ¶
func (x *Config_ConfigSetEntry) MarshalProtoText() string
func (*Config_ConfigSetEntry) ProtoMessage ¶
func (*Config_ConfigSetEntry) ProtoMessage()
func (*Config_ConfigSetEntry) Reset ¶
func (x *Config_ConfigSetEntry) Reset()
func (*Config_ConfigSetEntry) String ¶
func (x *Config_ConfigSetEntry) String() string
func (*Config_ConfigSetEntry) UnmarshalJSON ¶
func (x *Config_ConfigSetEntry) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the Config_ConfigSetEntry from JSON.
func (*Config_ConfigSetEntry) UnmarshalProtoJSON ¶
func (x *Config_ConfigSetEntry) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the Config_ConfigSetEntry message from JSON.
type Config_HostConfigSetEntry ¶
type Config_HostConfigSetEntry struct {
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
Value *proto.ControllerConfig `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
// contains filtered or unexported fields
}
func (*Config_HostConfigSetEntry) GetKey ¶
func (x *Config_HostConfigSetEntry) GetKey() string
func (*Config_HostConfigSetEntry) GetValue ¶
func (x *Config_HostConfigSetEntry) GetValue() *proto.ControllerConfig
func (*Config_HostConfigSetEntry) MarshalJSON ¶
func (x *Config_HostConfigSetEntry) MarshalJSON() ([]byte, error)
MarshalJSON marshals the Config_HostConfigSetEntry to JSON.
func (*Config_HostConfigSetEntry) MarshalProtoJSON ¶
func (x *Config_HostConfigSetEntry) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the Config_HostConfigSetEntry message to JSON.
func (*Config_HostConfigSetEntry) MarshalProtoText ¶
func (x *Config_HostConfigSetEntry) MarshalProtoText() string
func (*Config_HostConfigSetEntry) ProtoMessage ¶
func (*Config_HostConfigSetEntry) ProtoMessage()
func (*Config_HostConfigSetEntry) Reset ¶
func (x *Config_HostConfigSetEntry) Reset()
func (*Config_HostConfigSetEntry) String ¶
func (x *Config_HostConfigSetEntry) String() string
func (*Config_HostConfigSetEntry) UnmarshalJSON ¶
func (x *Config_HostConfigSetEntry) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the Config_HostConfigSetEntry from JSON.
func (*Config_HostConfigSetEntry) UnmarshalProtoJSON ¶
func (x *Config_HostConfigSetEntry) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the Config_HostConfigSetEntry message from JSON.
type Config_PlatformTypesEntry ¶
type Config_PlatformTypesEntry struct {
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
Value *Config `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
// contains filtered or unexported fields
}
func (*Config_PlatformTypesEntry) GetKey ¶
func (x *Config_PlatformTypesEntry) GetKey() string
func (*Config_PlatformTypesEntry) GetValue ¶
func (x *Config_PlatformTypesEntry) GetValue() *Config
func (*Config_PlatformTypesEntry) MarshalJSON ¶
func (x *Config_PlatformTypesEntry) MarshalJSON() ([]byte, error)
MarshalJSON marshals the Config_PlatformTypesEntry to JSON.
func (*Config_PlatformTypesEntry) MarshalProtoJSON ¶
func (x *Config_PlatformTypesEntry) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the Config_PlatformTypesEntry message to JSON.
func (*Config_PlatformTypesEntry) MarshalProtoText ¶
func (x *Config_PlatformTypesEntry) MarshalProtoText() string
func (*Config_PlatformTypesEntry) ProtoMessage ¶
func (*Config_PlatformTypesEntry) ProtoMessage()
func (*Config_PlatformTypesEntry) Reset ¶
func (x *Config_PlatformTypesEntry) Reset()
func (*Config_PlatformTypesEntry) String ¶
func (x *Config_PlatformTypesEntry) String() string
func (*Config_PlatformTypesEntry) UnmarshalJSON ¶
func (x *Config_PlatformTypesEntry) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the Config_PlatformTypesEntry from JSON.
func (*Config_PlatformTypesEntry) UnmarshalProtoJSON ¶
func (x *Config_PlatformTypesEntry) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the Config_PlatformTypesEntry message from JSON.
type Controller ¶
type Controller struct {
*bus.BusController[*Config]
// contains filtered or unexported fields
}
Controller is the compiler controller.
func NewController ¶
NewController constructs a new plugin compiler controller.
func NewControllerWithBusController ¶
func NewControllerWithBusController(base *bus.BusController[*Config]) (*Controller, error)
NewControllerWithBusController constructs a new plugin compiler controller with an existing BusController.
func (*Controller) AddPreBuildHook ¶
func (c *Controller) AddPreBuildHook(hook PreBuildHook)
AddPreBuildHook adds a callback that is called just after constructing the plugin working dir. Called before calling the Go compiler or bundling the assets or dist fs. NOTE: may be removed in future
func (*Controller) BuildManifest ¶
func (c *Controller) BuildManifest( ctx context.Context, args *bldr_manifest_builder.BuildManifestArgs, buildHost bldr_manifest_builder.BuildManifestHost, ) (*bldr_manifest_builder.BuilderResult, error)
BuildManifest compiles the manifest with the given builder args.
func (*Controller) BuildPlugin ¶
func (c *Controller) BuildPlugin( ctx context.Context, le *logrus.Entry, pluginMeta *bldr_plugin.PluginMeta, buildWorld world.Engine, buildHost bldr_manifest_builder.BuildManifestHost, buildType bldr_manifest.BuildType, buildPlatform bldr_platform.Platform, outBinName, workingPath, sourcePath, distSourcePath, outDistPath, outAssetsPath string, goPkgs []string, webPkgs []*bldr_web_bundler.WebPkgRefConfig, webPluginID string, disableRpcFetch bool, delveAddr string, configSet map[string]*configset_proto.ControllerConfig, hostConfigSet map[string]*configset_proto.ControllerConfig, enableCgoOpt enabled.Enabled, enableTinygoOpt enabled.Enabled, enableCompressionOpt enabled.Enabled, baseEsbuildFlags []string, devInfoFile string, ) (*Analysis, *bldr_manifest_builder.InputManifest, error)
BuildPlugin compiles the plugin once, committing it to the target world.
webPluginID is optional, if set, automatically adds controllers to configure the web plugin. Returns a list of source files from the list of given goPkgs. Source files list includes all files consumed by esbuild. This is the main function that orchestrates the entire plugin build process.
func (*Controller) Execute ¶
func (c *Controller) Execute(ctx context.Context) error
Execute executes the controller goroutine.
func (*Controller) FastRebuildPlugin ¶
func (c *Controller) FastRebuildPlugin( ctx context.Context, le *logrus.Entry, pluginID, sourcePath, distSourcePath, workingPath, outDistPath, outAssetsPath string, baseEsbuildFlags []string, prevInputManifest *bldr_manifest_builder.InputManifest, changedFiles []*bldr_manifest_builder.InputManifest_File, devInfoFile string, builderConf *bldr_manifest_builder.BuilderConfig, buildHost bldr_manifest_builder.BuildManifestHost, buildWorld world.Engine, ) (*bldr_manifest_builder.InputManifest, error)
FastRebuildPlugin compiles the plugin once skipping running the Go compiler if possible. Assumes we are in dev mode (not release mode). Assumes the previous result is already checked out to outDistPath and outAssetsPath. Returns nil, nil if fast rebuild is not applicable.
func (*Controller) GetSupportedPlatforms ¶
func (c *Controller) GetSupportedPlatforms() []string
GetSupportedPlatforms returns the base platform IDs this compiler supports.
func (*Controller) SupportsStartupManifestCache ¶
func (c *Controller) SupportsStartupManifestCache() bool
SupportsStartupManifestCache returns true if startup cache reuse is safe.
type EsbuildBundleVarMeta ¶
type EsbuildBundleVarMeta struct {
// Id is the identifier of the bundle.
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
// EntrypointVars is the list of entrypoint variables.
EntrypointVars []*EsbuildEntrypointVar `protobuf:"bytes,2,rep,name=entrypoint_vars,json=entrypointVars,proto3" json:"entrypointVars,omitempty"`
// contains filtered or unexported fields
}
EsbuildBundleVarMeta is information about an esbuild bundle.
func BuildEsbuildBundleVarMeta ¶
func BuildEsbuildBundleVarMeta( le *logrus.Entry, codeRootPath string, codeFiles map[string][]*ast.File, fset *token.FileSet, pkgs map[string](map[string]*EsbuildDirective), ) ([]*EsbuildBundleVarMeta, error)
BuildEsbuildBundleVarMeta builds the bundle metadata from the list of go variable defs.
func (*EsbuildBundleVarMeta) CloneMessageVT ¶
func (m *EsbuildBundleVarMeta) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*EsbuildBundleVarMeta) CloneVT ¶
func (m *EsbuildBundleVarMeta) CloneVT() *EsbuildBundleVarMeta
func (*EsbuildBundleVarMeta) EqualMessageVT ¶
func (this *EsbuildBundleVarMeta) EqualMessageVT(thatMsg any) bool
func (*EsbuildBundleVarMeta) EqualVT ¶
func (this *EsbuildBundleVarMeta) EqualVT(that *EsbuildBundleVarMeta) bool
func (*EsbuildBundleVarMeta) GetEntrypointVars ¶
func (x *EsbuildBundleVarMeta) GetEntrypointVars() []*EsbuildEntrypointVar
func (*EsbuildBundleVarMeta) GetId ¶
func (x *EsbuildBundleVarMeta) GetId() string
func (*EsbuildBundleVarMeta) MarshalJSON ¶
func (x *EsbuildBundleVarMeta) MarshalJSON() ([]byte, error)
MarshalJSON marshals the EsbuildBundleVarMeta to JSON.
func (*EsbuildBundleVarMeta) MarshalProtoJSON ¶
func (x *EsbuildBundleVarMeta) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the EsbuildBundleVarMeta message to JSON.
func (*EsbuildBundleVarMeta) MarshalProtoText ¶
func (x *EsbuildBundleVarMeta) MarshalProtoText() string
func (*EsbuildBundleVarMeta) MarshalToSizedBufferVT ¶
func (m *EsbuildBundleVarMeta) MarshalToSizedBufferVT(dAtA []byte) (int, error)
func (*EsbuildBundleVarMeta) MarshalToVT ¶
func (m *EsbuildBundleVarMeta) MarshalToVT(dAtA []byte) (int, error)
func (*EsbuildBundleVarMeta) MarshalVT ¶
func (m *EsbuildBundleVarMeta) MarshalVT() (dAtA []byte, err error)
func (*EsbuildBundleVarMeta) ProtoMessage ¶
func (*EsbuildBundleVarMeta) ProtoMessage()
func (*EsbuildBundleVarMeta) Reset ¶
func (x *EsbuildBundleVarMeta) Reset()
func (*EsbuildBundleVarMeta) SizeVT ¶
func (m *EsbuildBundleVarMeta) SizeVT() (n int)
func (*EsbuildBundleVarMeta) SortEntrypointVars ¶
func (m *EsbuildBundleVarMeta) SortEntrypointVars()
SortEntrypointVars sorts the entrypoint variables field.
func (*EsbuildBundleVarMeta) String ¶
func (x *EsbuildBundleVarMeta) String() string
func (*EsbuildBundleVarMeta) UnmarshalJSON ¶
func (x *EsbuildBundleVarMeta) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the EsbuildBundleVarMeta from JSON.
func (*EsbuildBundleVarMeta) UnmarshalProtoJSON ¶
func (x *EsbuildBundleVarMeta) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the EsbuildBundleVarMeta message from JSON.
func (*EsbuildBundleVarMeta) UnmarshalVT ¶
func (m *EsbuildBundleVarMeta) UnmarshalVT(dAtA []byte) error
type EsbuildDirective ¶
type EsbuildDirective struct {
// BundleID is the bundle identifier to use for esbuild.
// If unset, uses "default".
BundleID string
// EsbuildFlags are the esbuild build options.
// Note that all BuildOptions for the same BundleID are merged.
EsbuildFlags []string
// EsbuildVarType is the type of esbuild output variable we are using.
EsbuildVarType EsbuildVarType
}
EsbuildDirective are arguments parsed from a bldr:esbuild directive.
type EsbuildEntrypointVar ¶
type EsbuildEntrypointVar struct {
// PkgImportPath is the go package import path.
PkgImportPath string `protobuf:"bytes,1,opt,name=pkg_import_path,json=pkgImportPath,proto3" json:"pkgImportPath,omitempty"`
// PkgVar is the variable within the go package.
PkgVar string `protobuf:"bytes,2,opt,name=pkg_var,json=pkgVar,proto3" json:"pkgVar,omitempty"`
// PkgCodePath is the relative path to the code dir from the project root.
PkgCodePath string `protobuf:"bytes,3,opt,name=pkg_code_path,json=pkgCodePath,proto3" json:"pkgCodePath,omitempty"`
// PkgVarType is the type of esbuild variable this is.
PkgVarType EsbuildVarType `protobuf:"varint,4,opt,name=pkg_var_type,json=pkgVarType,proto3" json:"pkgVarType,omitempty"`
// EsbuildFlags are the command-line arguments to pass to esbuild.
EsbuildFlags []string `protobuf:"bytes,5,rep,name=esbuild_flags,json=esbuildFlags,proto3" json:"esbuildFlags,omitempty"`
// contains filtered or unexported fields
}
EsbuildEntrypointVar is a variable in the Go code referring to a esbuild entrypoint.
func (*EsbuildEntrypointVar) CloneMessageVT ¶
func (m *EsbuildEntrypointVar) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*EsbuildEntrypointVar) CloneVT ¶
func (m *EsbuildEntrypointVar) CloneVT() *EsbuildEntrypointVar
func (*EsbuildEntrypointVar) EqualMessageVT ¶
func (this *EsbuildEntrypointVar) EqualMessageVT(thatMsg any) bool
func (*EsbuildEntrypointVar) EqualVT ¶
func (this *EsbuildEntrypointVar) EqualVT(that *EsbuildEntrypointVar) bool
func (*EsbuildEntrypointVar) GetEsbuildFlags ¶
func (x *EsbuildEntrypointVar) GetEsbuildFlags() []string
func (*EsbuildEntrypointVar) GetPkgCodePath ¶
func (x *EsbuildEntrypointVar) GetPkgCodePath() string
func (*EsbuildEntrypointVar) GetPkgImportPath ¶
func (x *EsbuildEntrypointVar) GetPkgImportPath() string
func (*EsbuildEntrypointVar) GetPkgVar ¶
func (x *EsbuildEntrypointVar) GetPkgVar() string
func (*EsbuildEntrypointVar) GetPkgVarType ¶
func (x *EsbuildEntrypointVar) GetPkgVarType() EsbuildVarType
func (*EsbuildEntrypointVar) MarshalJSON ¶
func (x *EsbuildEntrypointVar) MarshalJSON() ([]byte, error)
MarshalJSON marshals the EsbuildEntrypointVar to JSON.
func (*EsbuildEntrypointVar) MarshalProtoJSON ¶
func (x *EsbuildEntrypointVar) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the EsbuildEntrypointVar message to JSON.
func (*EsbuildEntrypointVar) MarshalProtoText ¶
func (x *EsbuildEntrypointVar) MarshalProtoText() string
func (*EsbuildEntrypointVar) MarshalToSizedBufferVT ¶
func (m *EsbuildEntrypointVar) MarshalToSizedBufferVT(dAtA []byte) (int, error)
func (*EsbuildEntrypointVar) MarshalToVT ¶
func (m *EsbuildEntrypointVar) MarshalToVT(dAtA []byte) (int, error)
func (*EsbuildEntrypointVar) MarshalVT ¶
func (m *EsbuildEntrypointVar) MarshalVT() (dAtA []byte, err error)
func (*EsbuildEntrypointVar) ProtoMessage ¶
func (*EsbuildEntrypointVar) ProtoMessage()
func (*EsbuildEntrypointVar) Reset ¶
func (x *EsbuildEntrypointVar) Reset()
func (*EsbuildEntrypointVar) SizeVT ¶
func (m *EsbuildEntrypointVar) SizeVT() (n int)
func (*EsbuildEntrypointVar) String ¶
func (x *EsbuildEntrypointVar) String() string
func (*EsbuildEntrypointVar) ToEsbuildEntrypointId ¶
func (m *EsbuildEntrypointVar) ToEsbuildEntrypointId(bundleID string) string
ToEsbuildEntrypointId converts an EsbuildEntrypointVar to an esbuild bundle entrypoint id.
func (*EsbuildEntrypointVar) UnmarshalJSON ¶
func (x *EsbuildEntrypointVar) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the EsbuildEntrypointVar from JSON.
func (*EsbuildEntrypointVar) UnmarshalProtoJSON ¶
func (x *EsbuildEntrypointVar) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the EsbuildEntrypointVar message from JSON.
func (*EsbuildEntrypointVar) UnmarshalVT ¶
func (m *EsbuildEntrypointVar) UnmarshalVT(dAtA []byte) error
type EsbuildVarType ¶
type EsbuildVarType int32
EsbuildVarType is the list of types of esbuild output variable.
const ( // EsbuildVarType_ENTRYPOINT_PATH is the path to the main entrypoint script. // output type is a string EsbuildVarType_EsbuildVarType_ENTRYPOINT_PATH EsbuildVarType = 0 // EsbuildVarType_WEB_BUNDLER_OUTPUT contains a single web bundler output object. // output type is bldr_web_bundler.WebBundlerOutput EsbuildVarType_EsbuildVarType_WEB_BUNDLER_OUTPUT EsbuildVarType = 1 )
func (EsbuildVarType) Enum ¶
func (x EsbuildVarType) Enum() *EsbuildVarType
func (EsbuildVarType) MarshalJSON ¶
func (x EsbuildVarType) MarshalJSON() ([]byte, error)
MarshalJSON marshals the EsbuildVarType to JSON.
func (EsbuildVarType) MarshalProtoJSON ¶
func (x EsbuildVarType) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the EsbuildVarType to JSON.
func (EsbuildVarType) MarshalProtoText ¶
func (x EsbuildVarType) MarshalProtoText() string
func (EsbuildVarType) MarshalText ¶
func (x EsbuildVarType) MarshalText() ([]byte, error)
MarshalText marshals the EsbuildVarType to text.
func (EsbuildVarType) String ¶
func (x EsbuildVarType) String() string
func (*EsbuildVarType) UnmarshalJSON ¶
func (x *EsbuildVarType) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the EsbuildVarType from JSON.
func (*EsbuildVarType) UnmarshalProtoJSON ¶
func (x *EsbuildVarType) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the EsbuildVarType from JSON.
func (*EsbuildVarType) UnmarshalText ¶
func (x *EsbuildVarType) UnmarshalText(b []byte) error
UnmarshalText unmarshals the EsbuildVarType from text.
type Factory ¶
type Factory = bus.BusFactory[*Config, *Controller]
Factory is the factory for the compiler controller.
type InputFileKind ¶
type InputFileKind int32
InputFileKind is the kind of file this is.
const ( // InputFileKind_UNKNOWN is the default kind. InputFileKind_InputFileKind_UNKNOWN InputFileKind = 0 // InputFileKind_ASSET is a static asset. InputFileKind_InputFileKind_ASSET InputFileKind = 1 // InputFileKind_GO is a file built by the Go compiler. InputFileKind_InputFileKind_GO InputFileKind = 2 )
func (InputFileKind) Enum ¶
func (x InputFileKind) Enum() *InputFileKind
func (InputFileKind) MarshalJSON ¶
func (x InputFileKind) MarshalJSON() ([]byte, error)
MarshalJSON marshals the InputFileKind to JSON.
func (InputFileKind) MarshalProtoJSON ¶
func (x InputFileKind) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the InputFileKind to JSON.
func (InputFileKind) MarshalProtoText ¶
func (x InputFileKind) MarshalProtoText() string
func (InputFileKind) MarshalText ¶
func (x InputFileKind) MarshalText() ([]byte, error)
MarshalText marshals the InputFileKind to text.
func (InputFileKind) String ¶
func (x InputFileKind) String() string
func (*InputFileKind) UnmarshalJSON ¶
func (x *InputFileKind) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the InputFileKind from JSON.
func (*InputFileKind) UnmarshalProtoJSON ¶
func (x *InputFileKind) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the InputFileKind from JSON.
func (*InputFileKind) UnmarshalText ¶
func (x *InputFileKind) UnmarshalText(b []byte) error
UnmarshalText unmarshals the InputFileKind from text.
type InputFileMeta ¶
type InputFileMeta struct {
// Kind is the input file kind.
Kind InputFileKind `protobuf:"varint,1,opt,name=kind,proto3" json:"kind,omitempty"`
// contains filtered or unexported fields
}
InputFileMeta is metadata attached to an input manifest file.
func (*InputFileMeta) CloneMessageVT ¶
func (m *InputFileMeta) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*InputFileMeta) CloneVT ¶
func (m *InputFileMeta) CloneVT() *InputFileMeta
func (*InputFileMeta) EqualMessageVT ¶
func (this *InputFileMeta) EqualMessageVT(thatMsg any) bool
func (*InputFileMeta) EqualVT ¶
func (this *InputFileMeta) EqualVT(that *InputFileMeta) bool
func (*InputFileMeta) GetKind ¶
func (x *InputFileMeta) GetKind() InputFileKind
func (*InputFileMeta) MarshalJSON ¶
func (x *InputFileMeta) MarshalJSON() ([]byte, error)
MarshalJSON marshals the InputFileMeta to JSON.
func (*InputFileMeta) MarshalProtoJSON ¶
func (x *InputFileMeta) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the InputFileMeta message to JSON.
func (*InputFileMeta) MarshalProtoText ¶
func (x *InputFileMeta) MarshalProtoText() string
func (*InputFileMeta) MarshalToSizedBufferVT ¶
func (m *InputFileMeta) MarshalToSizedBufferVT(dAtA []byte) (int, error)
func (*InputFileMeta) MarshalToVT ¶
func (m *InputFileMeta) MarshalToVT(dAtA []byte) (int, error)
func (*InputFileMeta) MarshalVT ¶
func (m *InputFileMeta) MarshalVT() (dAtA []byte, err error)
func (*InputFileMeta) ProtoMessage ¶
func (*InputFileMeta) ProtoMessage()
func (*InputFileMeta) Reset ¶
func (x *InputFileMeta) Reset()
func (*InputFileMeta) SizeVT ¶
func (m *InputFileMeta) SizeVT() (n int)
func (*InputFileMeta) String ¶
func (x *InputFileMeta) String() string
func (*InputFileMeta) UnmarshalJSON ¶
func (x *InputFileMeta) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the InputFileMeta from JSON.
func (*InputFileMeta) UnmarshalProtoJSON ¶
func (x *InputFileMeta) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the InputFileMeta message from JSON.
func (*InputFileMeta) UnmarshalVT ¶
func (m *InputFileMeta) UnmarshalVT(dAtA []byte) error
type InputManifestMeta ¶
type InputManifestMeta struct {
// DevInfo contains the set of plugin variable definitions.
DevInfo *vardef.PluginDevInfo `protobuf:"bytes,1,opt,name=dev_info,json=devInfo,proto3" json:"devInfo,omitempty"`
// WebPkgRefs contains the list of web pkg references.
WebPkgRefs []*pkg.WebPkgRef `protobuf:"bytes,2,rep,name=web_pkg_refs,json=webPkgRefs,proto3" json:"webPkgRefs,omitempty"`
// WebPkgs is the list of web pkgs that we separate from the bundle.
WebPkgs []*bundler.WebPkgRefConfig `protobuf:"bytes,3,rep,name=web_pkgs,json=webPkgs,proto3" json:"webPkgs,omitempty"`
// EsbuildFlags are the base command-line arguments to pass to all esbuild bundles.
EsbuildFlags []string `protobuf:"bytes,4,rep,name=esbuild_flags,json=esbuildFlags,proto3" json:"esbuildFlags,omitempty"`
// EsbuildBundles contains the set of esbuild bundles.
EsbuildBundles []*EsbuildBundleVarMeta `protobuf:"bytes,5,rep,name=esbuild_bundles,json=esbuildBundles,proto3" json:"esbuildBundles,omitempty"`
// EsbuildOutputs contains a list of files written by esbuild.
EsbuildOutputs []*esbuild.EsbuildOutputMeta `protobuf:"bytes,6,rep,name=esbuild_outputs,json=esbuildOutputs,proto3" json:"esbuildOutputs,omitempty"`
// ViteConfigPaths are paths to Vite configuration files to merge together.
ViteConfigPaths []string `protobuf:"bytes,7,rep,name=vite_config_paths,json=viteConfigPaths,proto3" json:"viteConfigPaths,omitempty"`
// ViteBundles is the list of vite bundles with entrypoint configs.
ViteBundles []*ViteBundleVarMeta `protobuf:"bytes,8,rep,name=vite_bundles,json=viteBundles,proto3" json:"viteBundles,omitempty"`
// ViteOutputs contains a list of files written by vite.
ViteOutputs []*vite.ViteOutputMeta `protobuf:"bytes,9,rep,name=vite_outputs,json=viteOutputs,proto3" json:"viteOutputs,omitempty"`
// ViteDisableProjectConfig indicates whether to disable automatic project config detection.
// Disables finding the root vite.conf.ts for the project.
ViteDisableProjectConfig bool `` /* 136-byte string literal not displayed */
// contains filtered or unexported fields
}
InputManifestMeta is metadata attached to the input manifest.
func (*InputManifestMeta) CloneMessageVT ¶
func (m *InputManifestMeta) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*InputManifestMeta) CloneVT ¶
func (m *InputManifestMeta) CloneVT() *InputManifestMeta
func (*InputManifestMeta) EqualMessageVT ¶
func (this *InputManifestMeta) EqualMessageVT(thatMsg any) bool
func (*InputManifestMeta) EqualVT ¶
func (this *InputManifestMeta) EqualVT(that *InputManifestMeta) bool
func (*InputManifestMeta) GetDevInfo ¶
func (x *InputManifestMeta) GetDevInfo() *vardef.PluginDevInfo
func (*InputManifestMeta) GetEsbuildBundles ¶
func (x *InputManifestMeta) GetEsbuildBundles() []*EsbuildBundleVarMeta
func (*InputManifestMeta) GetEsbuildFlags ¶
func (x *InputManifestMeta) GetEsbuildFlags() []string
func (*InputManifestMeta) GetEsbuildOutputs ¶
func (x *InputManifestMeta) GetEsbuildOutputs() []*esbuild.EsbuildOutputMeta
func (*InputManifestMeta) GetViteBundles ¶
func (x *InputManifestMeta) GetViteBundles() []*ViteBundleVarMeta
func (*InputManifestMeta) GetViteConfigPaths ¶
func (x *InputManifestMeta) GetViteConfigPaths() []string
func (*InputManifestMeta) GetViteDisableProjectConfig ¶
func (x *InputManifestMeta) GetViteDisableProjectConfig() bool
func (*InputManifestMeta) GetViteOutputs ¶
func (x *InputManifestMeta) GetViteOutputs() []*vite.ViteOutputMeta
func (*InputManifestMeta) GetWebPkgRefs ¶
func (x *InputManifestMeta) GetWebPkgRefs() []*pkg.WebPkgRef
func (*InputManifestMeta) GetWebPkgs ¶
func (x *InputManifestMeta) GetWebPkgs() []*bundler.WebPkgRefConfig
func (*InputManifestMeta) MarshalJSON ¶
func (x *InputManifestMeta) MarshalJSON() ([]byte, error)
MarshalJSON marshals the InputManifestMeta to JSON.
func (*InputManifestMeta) MarshalProtoJSON ¶
func (x *InputManifestMeta) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the InputManifestMeta message to JSON.
func (*InputManifestMeta) MarshalProtoText ¶
func (x *InputManifestMeta) MarshalProtoText() string
func (*InputManifestMeta) MarshalToSizedBufferVT ¶
func (m *InputManifestMeta) MarshalToSizedBufferVT(dAtA []byte) (int, error)
func (*InputManifestMeta) MarshalToVT ¶
func (m *InputManifestMeta) MarshalToVT(dAtA []byte) (int, error)
func (*InputManifestMeta) MarshalVT ¶
func (m *InputManifestMeta) MarshalVT() (dAtA []byte, err error)
func (*InputManifestMeta) ProtoMessage ¶
func (*InputManifestMeta) ProtoMessage()
func (*InputManifestMeta) Reset ¶
func (x *InputManifestMeta) Reset()
func (*InputManifestMeta) SizeVT ¶
func (m *InputManifestMeta) SizeVT() (n int)
func (*InputManifestMeta) String ¶
func (x *InputManifestMeta) String() string
func (*InputManifestMeta) UnmarshalJSON ¶
func (x *InputManifestMeta) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the InputManifestMeta from JSON.
func (*InputManifestMeta) UnmarshalProtoJSON ¶
func (x *InputManifestMeta) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the InputManifestMeta message from JSON.
func (*InputManifestMeta) UnmarshalVT ¶
func (m *InputManifestMeta) UnmarshalVT(dAtA []byte) error
type ModuleCompiler ¶
type ModuleCompiler struct {
// contains filtered or unexported fields
}
ModuleCompiler assembles a series of Go module files on disk to orchestrate "go build" commands and produce a plugin with unique import paths for the changed packages.
func NewModuleCompiler ¶
func NewModuleCompiler( ctx context.Context, le *logrus.Entry, pluginCodegenPath string, pluginGoModule string, ) (*ModuleCompiler, error)
NewModuleCompiler constructs a new module compiler.
func (*ModuleCompiler) CompilePlugin ¶
func (m *ModuleCompiler) CompilePlugin( ctx context.Context, le *logrus.Entry, outFile string, buildPlatform bldr_platform.Platform, buildType bldr_manifest.BuildType, enableCgo bool, useTinygo bool, ) error
CompilePlugin compiles the plugin to outFile. The module structure should have been built already.
func (*ModuleCompiler) CompilePluginDevWrapper ¶
func (m *ModuleCompiler) CompilePluginDevWrapper( ctx context.Context, le *logrus.Entry, outFile, dlvAddr string, buildPlatform bldr_platform.Platform, buildType bldr_manifest.BuildType, enableCgo bool, ) error
CompilePluginDevWrapper compiles a development wrapper for the plugin. The module structure should have been built already. If buildDevWrapper is set, build an entrypoint that runs the plugin. If buildDevWrapper is set, assumes paths: .bldr/build/myplugin/ and .bldr/dist/myplugin/ NOTE: This wrapper is intended to be run on the build machine in native mode.
func (*ModuleCompiler) GenerateModule ¶
func (m *ModuleCompiler) GenerateModule( analysis *Analysis, pluginMeta *bldr_plugin.PluginMeta, configSetBinary []byte, goVarDefs []*vardef.PluginVar, devInfoFile string, ) (*vardef.PluginDevInfo, error)
GenerateModule builds the module files in the codegen path.
if configSetBinary is set and len() != 0, will be embedded as a config set.
devInfoFile will be loaded at runtime and used to populate variables init(). if devInfoFile is empty, the values of the go variable defs are hardcoded into init(). if devInfoFile is set, the file will be written at that path.
type PreBuildHook ¶
type PreBuildHook func( ctx context.Context, builderConf *bldr_manifest_builder.BuilderConfig, worldEng world.Engine, ) (*PreBuildHookResult, error)
PreBuildHook is a callback called before building the plugin. Returns an optional PreBuildResult.
type PreBuildHookResult ¶
type PreBuildHookResult struct {
// Config is the configuration for the plugin build step.
// Merged with the existing configuration.
Config *Config `protobuf:"bytes,1,opt,name=config,proto3" json:"config,omitempty"`
// contains filtered or unexported fields
}
PreBuildHookResult is the output of a pre-build hook.
func (*PreBuildHookResult) CloneMessageVT ¶
func (m *PreBuildHookResult) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*PreBuildHookResult) CloneVT ¶
func (m *PreBuildHookResult) CloneVT() *PreBuildHookResult
func (*PreBuildHookResult) EqualMessageVT ¶
func (this *PreBuildHookResult) EqualMessageVT(thatMsg any) bool
func (*PreBuildHookResult) EqualVT ¶
func (this *PreBuildHookResult) EqualVT(that *PreBuildHookResult) bool
func (*PreBuildHookResult) GetConfig ¶
func (x *PreBuildHookResult) GetConfig() *Config
func (*PreBuildHookResult) MarshalJSON ¶
func (x *PreBuildHookResult) MarshalJSON() ([]byte, error)
MarshalJSON marshals the PreBuildHookResult to JSON.
func (*PreBuildHookResult) MarshalProtoJSON ¶
func (x *PreBuildHookResult) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the PreBuildHookResult message to JSON.
func (*PreBuildHookResult) MarshalProtoText ¶
func (x *PreBuildHookResult) MarshalProtoText() string
func (*PreBuildHookResult) MarshalToSizedBufferVT ¶
func (m *PreBuildHookResult) MarshalToSizedBufferVT(dAtA []byte) (int, error)
func (*PreBuildHookResult) MarshalToVT ¶
func (m *PreBuildHookResult) MarshalToVT(dAtA []byte) (int, error)
func (*PreBuildHookResult) MarshalVT ¶
func (m *PreBuildHookResult) MarshalVT() (dAtA []byte, err error)
func (*PreBuildHookResult) ProtoMessage ¶
func (*PreBuildHookResult) ProtoMessage()
func (*PreBuildHookResult) Reset ¶
func (x *PreBuildHookResult) Reset()
func (*PreBuildHookResult) SizeVT ¶
func (m *PreBuildHookResult) SizeVT() (n int)
func (*PreBuildHookResult) String ¶
func (x *PreBuildHookResult) String() string
func (*PreBuildHookResult) UnmarshalJSON ¶
func (x *PreBuildHookResult) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the PreBuildHookResult from JSON.
func (*PreBuildHookResult) UnmarshalProtoJSON ¶
func (x *PreBuildHookResult) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the PreBuildHookResult message from JSON.
func (*PreBuildHookResult) UnmarshalVT ¶
func (m *PreBuildHookResult) UnmarshalVT(dAtA []byte) error
type ViteBundleVarMeta ¶
type ViteBundleVarMeta struct {
// Id is the identifier of the bundle.
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
// EntrypointVars is the list of entrypoint variables.
EntrypointVars []*ViteEntrypointVar `protobuf:"bytes,2,rep,name=entrypoint_vars,json=entrypointVars,proto3" json:"entrypointVars,omitempty"`
// contains filtered or unexported fields
}
ViteBundleVarMeta is information about a vite bundle.
func BuildViteBundleVarMeta ¶
func BuildViteBundleVarMeta( le *logrus.Entry, codeRootPath string, codeFiles map[string][]*ast.File, fset *token.FileSet, pkgs map[string](map[string]*ViteDirective), ) ([]*ViteBundleVarMeta, error)
BuildViteBundleVarMeta builds the bundle metadata from the list of go variable defs.
func (*ViteBundleVarMeta) CloneMessageVT ¶
func (m *ViteBundleVarMeta) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*ViteBundleVarMeta) CloneVT ¶
func (m *ViteBundleVarMeta) CloneVT() *ViteBundleVarMeta
func (*ViteBundleVarMeta) EqualMessageVT ¶
func (this *ViteBundleVarMeta) EqualMessageVT(thatMsg any) bool
func (*ViteBundleVarMeta) EqualVT ¶
func (this *ViteBundleVarMeta) EqualVT(that *ViteBundleVarMeta) bool
func (*ViteBundleVarMeta) GetEntrypointVars ¶
func (x *ViteBundleVarMeta) GetEntrypointVars() []*ViteEntrypointVar
func (*ViteBundleVarMeta) GetId ¶
func (x *ViteBundleVarMeta) GetId() string
func (*ViteBundleVarMeta) MarshalJSON ¶
func (x *ViteBundleVarMeta) MarshalJSON() ([]byte, error)
MarshalJSON marshals the ViteBundleVarMeta to JSON.
func (*ViteBundleVarMeta) MarshalProtoJSON ¶
func (x *ViteBundleVarMeta) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the ViteBundleVarMeta message to JSON.
func (*ViteBundleVarMeta) MarshalProtoText ¶
func (x *ViteBundleVarMeta) MarshalProtoText() string
func (*ViteBundleVarMeta) MarshalToSizedBufferVT ¶
func (m *ViteBundleVarMeta) MarshalToSizedBufferVT(dAtA []byte) (int, error)
func (*ViteBundleVarMeta) MarshalToVT ¶
func (m *ViteBundleVarMeta) MarshalToVT(dAtA []byte) (int, error)
func (*ViteBundleVarMeta) MarshalVT ¶
func (m *ViteBundleVarMeta) MarshalVT() (dAtA []byte, err error)
func (*ViteBundleVarMeta) ProtoMessage ¶
func (*ViteBundleVarMeta) ProtoMessage()
func (*ViteBundleVarMeta) Reset ¶
func (x *ViteBundleVarMeta) Reset()
func (*ViteBundleVarMeta) SizeVT ¶
func (m *ViteBundleVarMeta) SizeVT() (n int)
func (*ViteBundleVarMeta) SortEntrypointVars ¶
func (m *ViteBundleVarMeta) SortEntrypointVars()
SortEntrypointVars sorts the entrypoint variables field.
func (*ViteBundleVarMeta) String ¶
func (x *ViteBundleVarMeta) String() string
func (*ViteBundleVarMeta) UnmarshalJSON ¶
func (x *ViteBundleVarMeta) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the ViteBundleVarMeta from JSON.
func (*ViteBundleVarMeta) UnmarshalProtoJSON ¶
func (x *ViteBundleVarMeta) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the ViteBundleVarMeta message from JSON.
func (*ViteBundleVarMeta) UnmarshalVT ¶
func (m *ViteBundleVarMeta) UnmarshalVT(dAtA []byte) error
type ViteDirective ¶
type ViteDirective struct {
// BundleID is the bundle identifier to use for vite.
// If unset, uses "default".
BundleID string
// ViteConfigPaths are the vite config paths options.
// Note that all BuildOptions for the same BundleID are merged.
ViteConfigPaths []string
// EntrypointPath is the entrypoint path for vite.
// This is the positional argument that doesn't start with a flag.
EntrypointPath string
// ViteVarType is the type of vite output variable we are using.
ViteVarType ViteVarType
// DisableProjectConfig indicates whether to disable automatic project config detection.
DisableProjectConfig bool
}
ViteDirective are arguments parsed from a bldr:vite directive.
type ViteDirectiveArgs ¶
type ViteDirectiveArgs struct {
// BundleID is the bundle identifier to use for vite.
BundleID string
// ViteConfigPaths are the vite config paths options.
ViteConfigPaths []string
// EntrypointPath is the entrypoint path for vite.
EntrypointPath string
// DisableProjectConfig indicates whether to disable automatic project config detection.
DisableProjectConfig bool
}
ViteDirectiveArgs contains the parsed arguments from a vite directive.
func ParseViteDirectiveArgs ¶
func ParseViteDirectiveArgs(args []string) (ViteDirectiveArgs, error)
ParseViteDirectiveArgs parses vite directive arguments to extract bundle ID, config paths, entrypoint path, and whether to disable project config detection. Only one positional argument is allowed as the entrypoint path.
type ViteEntrypointVar ¶
type ViteEntrypointVar struct {
// PkgImportPath is the go package import path.
PkgImportPath string `protobuf:"bytes,1,opt,name=pkg_import_path,json=pkgImportPath,proto3" json:"pkgImportPath,omitempty"`
// PkgVar is the variable within the go package.
PkgVar string `protobuf:"bytes,2,opt,name=pkg_var,json=pkgVar,proto3" json:"pkgVar,omitempty"`
// PkgCodePath is the relative path to the code dir from the project root.
PkgCodePath string `protobuf:"bytes,3,opt,name=pkg_code_path,json=pkgCodePath,proto3" json:"pkgCodePath,omitempty"`
// PkgVarType is the type of vite variable this is.
PkgVarType ViteVarType `protobuf:"varint,4,opt,name=pkg_var_type,json=pkgVarType,proto3" json:"pkgVarType,omitempty"`
// ViteConfigPaths are the vite config paths options for this variable.
ViteConfigPaths []string `protobuf:"bytes,5,rep,name=vite_config_paths,json=viteConfigPaths,proto3" json:"viteConfigPaths,omitempty"`
// EntrypointPath is the entrypoint path for vite.
EntrypointPath string `protobuf:"bytes,6,opt,name=entrypoint_path,json=entrypointPath,proto3" json:"entrypointPath,omitempty"`
// DisableProjectConfig indicates whether to disable automatic project config detection.
// Disables finding the root vite.conf.ts for the project.
DisableProjectConfig bool `protobuf:"varint,7,opt,name=disable_project_config,json=disableProjectConfig,proto3" json:"disableProjectConfig,omitempty"`
// contains filtered or unexported fields
}
ViteEntrypointVar is a variable in the Go code referring to a vite entrypoint.
func (*ViteEntrypointVar) CloneMessageVT ¶
func (m *ViteEntrypointVar) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*ViteEntrypointVar) CloneVT ¶
func (m *ViteEntrypointVar) CloneVT() *ViteEntrypointVar
func (*ViteEntrypointVar) EqualMessageVT ¶
func (this *ViteEntrypointVar) EqualMessageVT(thatMsg any) bool
func (*ViteEntrypointVar) EqualVT ¶
func (this *ViteEntrypointVar) EqualVT(that *ViteEntrypointVar) bool
func (*ViteEntrypointVar) GetDisableProjectConfig ¶
func (x *ViteEntrypointVar) GetDisableProjectConfig() bool
func (*ViteEntrypointVar) GetEntrypointPath ¶
func (x *ViteEntrypointVar) GetEntrypointPath() string
func (*ViteEntrypointVar) GetPkgCodePath ¶
func (x *ViteEntrypointVar) GetPkgCodePath() string
func (*ViteEntrypointVar) GetPkgImportPath ¶
func (x *ViteEntrypointVar) GetPkgImportPath() string
func (*ViteEntrypointVar) GetPkgVar ¶
func (x *ViteEntrypointVar) GetPkgVar() string
func (*ViteEntrypointVar) GetPkgVarType ¶
func (x *ViteEntrypointVar) GetPkgVarType() ViteVarType
func (*ViteEntrypointVar) GetViteConfigPaths ¶
func (x *ViteEntrypointVar) GetViteConfigPaths() []string
func (*ViteEntrypointVar) MarshalJSON ¶
func (x *ViteEntrypointVar) MarshalJSON() ([]byte, error)
MarshalJSON marshals the ViteEntrypointVar to JSON.
func (*ViteEntrypointVar) MarshalProtoJSON ¶
func (x *ViteEntrypointVar) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the ViteEntrypointVar message to JSON.
func (*ViteEntrypointVar) MarshalProtoText ¶
func (x *ViteEntrypointVar) MarshalProtoText() string
func (*ViteEntrypointVar) MarshalToSizedBufferVT ¶
func (m *ViteEntrypointVar) MarshalToSizedBufferVT(dAtA []byte) (int, error)
func (*ViteEntrypointVar) MarshalToVT ¶
func (m *ViteEntrypointVar) MarshalToVT(dAtA []byte) (int, error)
func (*ViteEntrypointVar) MarshalVT ¶
func (m *ViteEntrypointVar) MarshalVT() (dAtA []byte, err error)
func (*ViteEntrypointVar) ProtoMessage ¶
func (*ViteEntrypointVar) ProtoMessage()
func (*ViteEntrypointVar) Reset ¶
func (x *ViteEntrypointVar) Reset()
func (*ViteEntrypointVar) SizeVT ¶
func (m *ViteEntrypointVar) SizeVT() (n int)
func (*ViteEntrypointVar) String ¶
func (x *ViteEntrypointVar) String() string
func (*ViteEntrypointVar) UnmarshalJSON ¶
func (x *ViteEntrypointVar) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the ViteEntrypointVar from JSON.
func (*ViteEntrypointVar) UnmarshalProtoJSON ¶
func (x *ViteEntrypointVar) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the ViteEntrypointVar message from JSON.
func (*ViteEntrypointVar) UnmarshalVT ¶
func (m *ViteEntrypointVar) UnmarshalVT(dAtA []byte) error
type ViteVarType ¶
type ViteVarType int32
ViteVarType is the list of types of vite output variables.
const ( // ViteVarType_ENTRYPOINT_PATH is the path to the main entrypoint script. // output type is a string ViteVarType_ViteVarType_ENTRYPOINT_PATH ViteVarType = 0 // ViteVarType_WEB_BUNDLER_OUTPUT contains a single web bundler output object. // output type is bldr_web_bundler.WebBundlerOutput ViteVarType_ViteVarType_WEB_BUNDLER_OUTPUT ViteVarType = 1 )
func (ViteVarType) Enum ¶
func (x ViteVarType) Enum() *ViteVarType
func (ViteVarType) MarshalJSON ¶
func (x ViteVarType) MarshalJSON() ([]byte, error)
MarshalJSON marshals the ViteVarType to JSON.
func (ViteVarType) MarshalProtoJSON ¶
func (x ViteVarType) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the ViteVarType to JSON.
func (ViteVarType) MarshalProtoText ¶
func (x ViteVarType) MarshalProtoText() string
func (ViteVarType) MarshalText ¶
func (x ViteVarType) MarshalText() ([]byte, error)
MarshalText marshals the ViteVarType to text.
func (ViteVarType) String ¶
func (x ViteVarType) String() string
func (*ViteVarType) UnmarshalJSON ¶
func (x *ViteVarType) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the ViteVarType from JSON.
func (*ViteVarType) UnmarshalProtoJSON ¶
func (x *ViteVarType) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the ViteVarType from JSON.
func (*ViteVarType) UnmarshalText ¶
func (x *ViteVarType) UnmarshalText(b []byte) error
UnmarshalText unmarshals the ViteVarType from text.