bldr_plugin_compiler_js

package
v0.51.6 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: Apache-2.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

View Source
const ConfigID = "bldr/plugin/compiler/js"

ConfigID is the config identifier.

View Source
const ControllerID = ConfigID

ControllerID is the compiler controller ID.

Variables

View Source
var (
	JsModuleKind_name = map[int32]string{
		0: "JS_MODULE_KIND_INVALID",
		1: "JS_MODULE_KIND_BACKEND",
		2: "JS_MODULE_KIND_FRONTEND",
	}
	JsModuleKind_value = map[string]int32{
		"JS_MODULE_KIND_INVALID":  0,
		"JS_MODULE_KIND_BACKEND":  1,
		"JS_MODULE_KIND_FRONTEND": 2,
	}
)

Enum value maps for JsModuleKind.

View Source
var ErrUnexpectedVarType = errors.New("unexpected variable type for build directive")

ErrUnexpectedVarType is returned when a variable has an unexpected type.

View Source
var Version = semver.MustParse("0.0.1")

Version is the controller version

Functions

func CreateEntrypointsFromViteOutputs

func CreateEntrypointsFromViteOutputs(
	modules []*JsModule,
	viteOutputMeta []*bldr_web_bundler_vite.ViteOutputMeta,
	existingBackendEntrypoints []*BackendEntrypoint,
	existingFrontendEntrypoints []*FrontendEntrypoint,
) ([]*BackendEntrypoint, []*FrontendEntrypoint)

CreateEntrypointsFromViteOutputs matches Vite outputs to JS modules and creates backend/frontend entrypoints. Returns the updated backend and frontend entrypoint slices.

func NewFactory

func NewFactory(b bus.Bus) controller.Factory

NewFactory constructs a new plugin compiler controller factory.

func UpdateRelativeGoPackagePaths

func UpdateRelativeGoPackagePaths(jsPkgsList []string, rootModule string) ([]string, map[string]string)

UpdateRelativeGoPackagePaths applies the root module path to the js_packages list. Returns the updated packages list and the mappings from jsPkg to jsPkgName.

Types

type BackendEntrypoint

type BackendEntrypoint struct {

	// ImportPath is the path to the module within the assets fs to import().
	// Example: "esb/backend/index.js"
	// The path must export a export which matches ImportName (defaults to the default export).
	// For example: export default async function runBackend(api: bldr.PluginAPI): Promise<void> => {}
	ImportPath string `protobuf:"bytes,1,opt,name=import_path,json=importPath,proto3" json:"importPath,omitempty"`
	// ImportName is the name of the import to consume from the es module.
	// Defaults to "default" which is the default export.
	ImportName string `protobuf:"bytes,2,opt,name=import_name,json=importName,proto3" json:"importName,omitempty"`
	// contains filtered or unexported fields
}

BackendEntrypoint configures a backend entrypoint.

func (*BackendEntrypoint) CloneMessageVT

func (m *BackendEntrypoint) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*BackendEntrypoint) CloneVT

func (m *BackendEntrypoint) CloneVT() *BackendEntrypoint

func (*BackendEntrypoint) EqualMessageVT

func (this *BackendEntrypoint) EqualMessageVT(thatMsg any) bool

func (*BackendEntrypoint) EqualVT

func (this *BackendEntrypoint) EqualVT(that *BackendEntrypoint) bool

func (*BackendEntrypoint) GetImportName

func (x *BackendEntrypoint) GetImportName() string

func (*BackendEntrypoint) GetImportPath

func (x *BackendEntrypoint) GetImportPath() string

func (*BackendEntrypoint) MarshalJSON

func (x *BackendEntrypoint) MarshalJSON() ([]byte, error)

MarshalJSON marshals the BackendEntrypoint to JSON.

func (*BackendEntrypoint) MarshalProtoJSON

func (x *BackendEntrypoint) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the BackendEntrypoint message to JSON.

func (*BackendEntrypoint) MarshalProtoText

func (x *BackendEntrypoint) MarshalProtoText() string

func (*BackendEntrypoint) MarshalToSizedBufferVT

func (m *BackendEntrypoint) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*BackendEntrypoint) MarshalToVT

func (m *BackendEntrypoint) MarshalToVT(dAtA []byte) (int, error)

func (*BackendEntrypoint) MarshalVT

func (m *BackendEntrypoint) MarshalVT() (dAtA []byte, err error)

func (*BackendEntrypoint) ProtoMessage

func (*BackendEntrypoint) ProtoMessage()

func (*BackendEntrypoint) Reset

func (x *BackendEntrypoint) Reset()

func (*BackendEntrypoint) SizeVT

func (m *BackendEntrypoint) SizeVT() (n int)

func (*BackendEntrypoint) String

func (x *BackendEntrypoint) String() string

func (*BackendEntrypoint) UnmarshalJSON

func (x *BackendEntrypoint) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the BackendEntrypoint from JSON.

func (*BackendEntrypoint) UnmarshalProtoJSON

func (x *BackendEntrypoint) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the BackendEntrypoint message from JSON.

func (*BackendEntrypoint) UnmarshalVT

func (m *BackendEntrypoint) UnmarshalVT(dAtA []byte) error

func (*BackendEntrypoint) Validate

func (m *BackendEntrypoint) Validate() error

Validate validates the BackendEntrypoint configuration.

type Config

type Config struct {

	// Modules is a high-level way of defining elements of a Js plugin.
	//
	// See the top-level comments on Config for details.
	Modules []*JsModule `protobuf:"bytes,1,rep,name=modules,proto3" json:"modules,omitempty"`
	// EsbuildBundles is the list of esbuild bundles to compile.
	// These bundles will be included in the assets fs under esb/
	EsbuildBundles []*compiler.EsbuildBundleMeta `protobuf:"bytes,2,rep,name=esbuild_bundles,json=esbuildBundles,proto3" json:"esbuildBundles,omitempty"`
	// EsbuildFlags is a string list containing additional flags to pass to esbuild.
	// Flags passed by esbuild_bundles can override these values.
	// E.x.: --target es2020
	EsbuildFlags []string `protobuf:"bytes,3,rep,name=esbuild_flags,json=esbuildFlags,proto3" json:"esbuildFlags,omitempty"`
	// ViteBundles is the list of vite bundles to compile.
	// These bundles will be included in the assets fs under vite/
	ViteBundles []*compiler1.ViteBundleMeta `protobuf:"bytes,4,rep,name=vite_bundles,json=viteBundles,proto3" json:"viteBundles,omitempty"`
	// ViteConfigPaths is a list of paths to Vite configuration files to apply to all bundles.
	// Ignored unless any vite_bundles are defined.
	ViteConfigPaths []string `protobuf:"bytes,5,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 `` /* 135-byte string literal not displayed */
	// BackendEntrypoints are scripts loaded from the assets fs when the plugin is started into the backend.
	// The backend is usually a WebWorker.
	BackendEntrypoints []*BackendEntrypoint `protobuf:"bytes,7,rep,name=backend_entrypoints,json=backendEntrypoints,proto3" json:"backendEntrypoints,omitempty"`
	// FrontendEntrypoints are scripts loaded from the assets fs into the frontend.
	// The frontend is usually a WebView.
	FrontendEntrypoints []*FrontendEntrypoint `protobuf:"bytes,8,rep,name=frontend_entrypoints,json=frontendEntrypoints,proto3" json:"frontendEntrypoints,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,9,rep,name=web_pkgs,json=webPkgs,proto3" json:"webPkgs,omitempty"`
	// 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 `` /* 189-byte string literal not displayed */
	// DisableRpcFetch disables the default Fetch RPC service handler.
	// The handler handles the Fetch service by consuming a set of HTTP handlers.
	// This service is used for the ServiceWorker HTTP calls.
	// TODO: unimplemented
	DisableRpcFetch bool `protobuf:"varint,11,opt,name=disable_rpc_fetch,json=disableRpcFetch,proto3" json:"disableRpcFetch,omitempty"`
	// WebPluginId sets the plugin id for the web plugin.
	//
	// If set, the plugin will load the web plugin with the given ID and load frontend entrypoints.
	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 Js/TypeScript plugin compiler controller.

This configuration uses the terminology "backend" to refer to the plugin code and "frontend" to bundles included in the assets filesystem served by the plugin code, for example, to WebView with SetRenderMode.

There are two ways to specify code to include in the plugin:

- Define in the "modules" list, which is a shortcut for configuring entrypoints and bundles. - Define bundles in esbuild_bundles or vite_bundles and entrypoints that consume those bundles.

The most common way to use this plugin is:

- Define your plugin backend .ts (runs in a WebWorker) in modules with type BACKEND - Define your app frontend .tsx (runs in a WebView) in modules with type FRONTEND

This will configure:

- Vite compiler with two bundle entrypoints: frontend and backend. - Entrypoint which on the plugin backend:

  • imports and calls the backend package esmodule(s)
  • serves the frontend package to any WebView without a parent (a root WebView)
  • applies any configured hostConfigSet
  • serves the plugin assets fs at /p/{plugin-id}/a/{asset-path}

Alternatively you can manually configure the bundles and entrypoints for more control.

func NewConfig

func NewConfig() *Config

NewConfig constructs a new config.

func (*Config) Alloc

func (c *Config) Alloc()

Alloc allocates any nil maps.

func (*Config) CloneMessageVT

func (m *Config) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*Config) CloneVT

func (m *Config) CloneVT() *Config

func (*Config) EqualMessageVT

func (this *Config) EqualMessageVT(thatMsg any) bool

func (*Config) EqualVT

func (this *Config) EqualVT(that *Config) bool

func (*Config) EqualsConfig

func (c *Config) EqualsConfig(other config.Config) bool

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) GetBackendEntrypoints

func (x *Config) GetBackendEntrypoints() []*BackendEntrypoint

func (*Config) GetBuildTypes

func (x *Config) GetBuildTypes() map[string]*Config

func (*Config) GetConfigID

func (c *Config) GetConfigID() string

GetConfigID returns the unique string for this configuration type.

func (*Config) GetDisableRpcFetch

func (x *Config) GetDisableRpcFetch() bool

func (*Config) GetEsbuildBundles

func (x *Config) GetEsbuildBundles() []*compiler.EsbuildBundleMeta

func (*Config) GetEsbuildFlags

func (x *Config) GetEsbuildFlags() []string

func (*Config) GetFrontendEntrypoints

func (x *Config) GetFrontendEntrypoints() []*FrontendEntrypoint

func (*Config) GetHostConfigSet

func (x *Config) GetHostConfigSet() map[string]*proto.ControllerConfig

func (*Config) GetModules

func (x *Config) GetModules() []*JsModule

func (*Config) GetPlatformTypes

func (x *Config) GetPlatformTypes() map[string]*Config

func (*Config) GetViteBundles

func (x *Config) GetViteBundles() []*compiler1.ViteBundleMeta

func (*Config) GetViteConfigPaths

func (x *Config) GetViteConfigPaths() []string

func (*Config) GetViteDisableProjectConfig

func (x *Config) GetViteDisableProjectConfig() bool

func (*Config) GetWebPkgs

func (x *Config) GetWebPkgs() []*bundler.WebPkgRefConfig

func (*Config) GetWebPluginId

func (x *Config) GetWebPluginId() string

func (*Config) MarshalJSON

func (x *Config) MarshalJSON() ([]byte, error)

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 (x *Config) MarshalProtoText() string

func (*Config) MarshalToSizedBufferVT

func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Config) MarshalToVT

func (m *Config) MarshalToVT(dAtA []byte) (int, error)

func (*Config) MarshalVT

func (m *Config) MarshalVT() (dAtA []byte, err error)

func (*Config) Merge

func (c *Config) Merge(o *Config)

Merge merges the given build config into c.

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) Reset

func (x *Config) Reset()

func (*Config) SizeVT

func (m *Config) SizeVT() (n int)

func (*Config) String

func (x *Config) String() string

func (*Config) UnmarshalJSON

func (x *Config) UnmarshalJSON(b []byte) error

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

func (m *Config) UnmarshalVT(dAtA []byte) error

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the configuration.

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_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 (*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

func NewController(le *logrus.Entry, b bus.Bus, conf *Config) (*Controller, error)

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. NOTE: may be removed in future

func (*Controller) BuildManifest

BuildManifest compiles the manifest with the given builder args.

func (*Controller) Execute

func (c *Controller) Execute(ctx context.Context) error

Execute executes the controller goroutine.

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 Factory

type Factory = bus.BusFactory[*Config, *Controller]

Factory is the factory for the compiler controller.

type FrontendEntrypoint

type FrontendEntrypoint struct {

	// SetRenderMode contains the set render mode request for the web view.
	// The script path will have /b/pa/{plugin-id}/ prepended to it automatically.
	// Ignored if empty.
	SetRenderMode *view.SetRenderModeRequest `protobuf:"bytes,1,opt,name=set_render_mode,json=setRenderMode,proto3" json:"setRenderMode,omitempty"`
	// SetHtmlLinks contains the set html links request for the web view.
	// The html links paths will have /b/pa/{plugin-id}/ prepended to them automatically.
	// Ignored if empty.
	SetHtmlLinks *view.SetHtmlLinksRequest `protobuf:"bytes,2,opt,name=set_html_links,json=setHtmlLinks,proto3" json:"setHtmlLinks,omitempty"`
	// WebViewId filters by web view id.
	WebViewId *filter.StringFilter `protobuf:"bytes,3,opt,name=web_view_id,json=webViewId,proto3" json:"webViewId,omitempty"`
	// WebViewParentId filters by web view parent id.
	WebViewParentId *filter.StringFilter `protobuf:"bytes,4,opt,name=web_view_parent_id,json=webViewParentId,proto3" json:"webViewParentId,omitempty"`
	// contains filtered or unexported fields
}

FrontendEntrypoint configures a frontend entrypoint.

func (*FrontendEntrypoint) CloneMessageVT

func (m *FrontendEntrypoint) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*FrontendEntrypoint) CloneVT

func (m *FrontendEntrypoint) CloneVT() *FrontendEntrypoint

func (*FrontendEntrypoint) EqualMessageVT

func (this *FrontendEntrypoint) EqualMessageVT(thatMsg any) bool

func (*FrontendEntrypoint) EqualVT

func (this *FrontendEntrypoint) EqualVT(that *FrontendEntrypoint) bool
func (x *FrontendEntrypoint) GetSetHtmlLinks() *view.SetHtmlLinksRequest

func (*FrontendEntrypoint) GetSetRenderMode

func (x *FrontendEntrypoint) GetSetRenderMode() *view.SetRenderModeRequest

func (*FrontendEntrypoint) GetWebViewId

func (x *FrontendEntrypoint) GetWebViewId() *filter.StringFilter

func (*FrontendEntrypoint) GetWebViewParentId

func (x *FrontendEntrypoint) GetWebViewParentId() *filter.StringFilter

func (*FrontendEntrypoint) MarshalJSON

func (x *FrontendEntrypoint) MarshalJSON() ([]byte, error)

MarshalJSON marshals the FrontendEntrypoint to JSON.

func (*FrontendEntrypoint) MarshalProtoJSON

func (x *FrontendEntrypoint) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the FrontendEntrypoint message to JSON.

func (*FrontendEntrypoint) MarshalProtoText

func (x *FrontendEntrypoint) MarshalProtoText() string

func (*FrontendEntrypoint) MarshalToSizedBufferVT

func (m *FrontendEntrypoint) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*FrontendEntrypoint) MarshalToVT

func (m *FrontendEntrypoint) MarshalToVT(dAtA []byte) (int, error)

func (*FrontendEntrypoint) MarshalVT

func (m *FrontendEntrypoint) MarshalVT() (dAtA []byte, err error)

func (*FrontendEntrypoint) ProtoMessage

func (*FrontendEntrypoint) ProtoMessage()

func (*FrontendEntrypoint) Reset

func (x *FrontendEntrypoint) Reset()

func (*FrontendEntrypoint) SizeVT

func (m *FrontendEntrypoint) SizeVT() (n int)

func (*FrontendEntrypoint) String

func (x *FrontendEntrypoint) String() string

func (*FrontendEntrypoint) UnmarshalJSON

func (x *FrontendEntrypoint) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the FrontendEntrypoint from JSON.

func (*FrontendEntrypoint) UnmarshalProtoJSON

func (x *FrontendEntrypoint) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the FrontendEntrypoint message from JSON.

func (*FrontendEntrypoint) UnmarshalVT

func (m *FrontendEntrypoint) UnmarshalVT(dAtA []byte) error

func (*FrontendEntrypoint) Validate

func (m *FrontendEntrypoint) Validate() error

Validate validates the FrontendEntrypoint configuration.

type InputManifestMeta

type InputManifestMeta struct {

	// WebPkgRefs contains the list of web pkg references.
	WebPkgRefs []*pkg.WebPkgRef `protobuf:"bytes,1,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,2,rep,name=web_pkgs,json=webPkgs,proto3" json:"webPkgs,omitempty"`
	// EsbuildBundles is the list of esbuild bundles that were configured.
	EsbuildBundles []*compiler.EsbuildBundleMeta `protobuf:"bytes,3,rep,name=esbuild_bundles,json=esbuildBundles,proto3" json:"esbuildBundles,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"`
	// EsbuildOutputs contains a list of files written by esbuild.
	EsbuildOutputs []*esbuild.EsbuildOutputMeta `protobuf:"bytes,5,rep,name=esbuild_outputs,json=esbuildOutputs,proto3" json:"esbuildOutputs,omitempty"`
	// ViteBundles is the list of vite bundles that were configured.
	ViteBundles []*compiler1.ViteBundleMeta `protobuf:"bytes,6,rep,name=vite_bundles,json=viteBundles,proto3" json:"viteBundles,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"`
	// ViteOutputs contains a list of files written by vite.
	ViteOutputs []*vite.ViteOutputMeta `protobuf:"bytes,8,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 `` /* 135-byte string literal not displayed */
	// CompiledEntrypointPath is the path within the assets filesystem to the compiled plugin entrypoint script.
	// Usually: plugin.mjs
	CompiledEntrypointPath string `` /* 128-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) GetCompiledEntrypointPath

func (x *InputManifestMeta) GetCompiledEntrypointPath() string

func (*InputManifestMeta) GetEsbuildBundles

func (x *InputManifestMeta) GetEsbuildBundles() []*compiler.EsbuildBundleMeta

func (*InputManifestMeta) GetEsbuildFlags

func (x *InputManifestMeta) GetEsbuildFlags() []string

func (*InputManifestMeta) GetEsbuildOutputs

func (x *InputManifestMeta) GetEsbuildOutputs() []*esbuild.EsbuildOutputMeta

func (*InputManifestMeta) GetViteBundles

func (x *InputManifestMeta) GetViteBundles() []*compiler1.ViteBundleMeta

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 JsModule

type JsModule struct {

	// Kind is the kind of the module.
	Kind JsModuleKind `protobuf:"varint,1,opt,name=kind,proto3" json:"kind,omitempty"`
	// Path is the path to the module source file relative to the project root.
	// Example: "src/plugin.ts"
	Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"`
	// ViteConfigPaths are the paths to Vite configuration files to use for this module's bundle.
	// These are merged with the top-level vite_config_paths.
	ViteConfigPaths []string `protobuf:"bytes,3,rep,name=vite_config_paths,json=viteConfigPaths,proto3" json:"viteConfigPaths,omitempty"`
	// DisableProjectConfig disables searching for the vite.config.ts in the project root for this module's bundle.
	// Overrides the top-level vite_disable_project_config if set to true.
	DisableProjectConfig bool `protobuf:"varint,4,opt,name=disable_project_config,json=disableProjectConfig,proto3" json:"disableProjectConfig,omitempty"`
	// Entrypoint enables adding an entrypoint for this module.
	// If false, no BackendEntrypoint or FrontendEntrypoint will be automatically created.
	Entrypoint bool `protobuf:"varint,5,opt,name=entrypoint,proto3" json:"entrypoint,omitempty"`
	// WebViewId filters by web view id for FRONTEND modules.
	// Frontend modules only create a FrontendEntrypoint when WebViewId or
	// WebViewParentId is set.
	WebViewId *filter.StringFilter `protobuf:"bytes,6,opt,name=web_view_id,json=webViewId,proto3" json:"webViewId,omitempty"`
	// WebViewParentId filters by web view parent id for FRONTEND modules.
	// Frontend modules only create a FrontendEntrypoint when WebViewId or
	// WebViewParentId is set.
	WebViewParentId *filter.StringFilter `protobuf:"bytes,7,opt,name=web_view_parent_id,json=webViewParentId,proto3" json:"webViewParentId,omitempty"`
	// contains filtered or unexported fields
}

JsModule defines a high-level module to include in the plugin.

This is a shortcut for configuring bundles and entrypoints. See the top-level comments on Config for details.

func (*JsModule) CloneMessageVT

func (m *JsModule) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*JsModule) CloneVT

func (m *JsModule) CloneVT() *JsModule

func (*JsModule) EqualMessageVT

func (this *JsModule) EqualMessageVT(thatMsg any) bool

func (*JsModule) EqualVT

func (this *JsModule) EqualVT(that *JsModule) bool

func (*JsModule) GetDisableProjectConfig

func (x *JsModule) GetDisableProjectConfig() bool

func (*JsModule) GetEntrypoint added in v0.51.2

func (x *JsModule) GetEntrypoint() bool

func (*JsModule) GetKind

func (x *JsModule) GetKind() JsModuleKind

func (*JsModule) GetPath

func (x *JsModule) GetPath() string

func (*JsModule) GetViteConfigPaths

func (x *JsModule) GetViteConfigPaths() []string

func (*JsModule) GetWebViewId

func (x *JsModule) GetWebViewId() *filter.StringFilter

func (*JsModule) GetWebViewParentId

func (x *JsModule) GetWebViewParentId() *filter.StringFilter

func (*JsModule) MarshalJSON

func (x *JsModule) MarshalJSON() ([]byte, error)

MarshalJSON marshals the JsModule to JSON.

func (*JsModule) MarshalProtoJSON

func (x *JsModule) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the JsModule message to JSON.

func (*JsModule) MarshalProtoText

func (x *JsModule) MarshalProtoText() string

func (*JsModule) MarshalToSizedBufferVT

func (m *JsModule) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*JsModule) MarshalToVT

func (m *JsModule) MarshalToVT(dAtA []byte) (int, error)

func (*JsModule) MarshalVT

func (m *JsModule) MarshalVT() (dAtA []byte, err error)

func (*JsModule) ProtoMessage

func (*JsModule) ProtoMessage()

func (*JsModule) Reset

func (x *JsModule) Reset()

func (*JsModule) SizeVT

func (m *JsModule) SizeVT() (n int)

func (*JsModule) String

func (x *JsModule) String() string

func (*JsModule) UnmarshalJSON

func (x *JsModule) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the JsModule from JSON.

func (*JsModule) UnmarshalProtoJSON

func (x *JsModule) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the JsModule message from JSON.

func (*JsModule) UnmarshalVT

func (m *JsModule) UnmarshalVT(dAtA []byte) error

func (*JsModule) Validate

func (m *JsModule) Validate() error

Validate validates the JsModule configuration.

type JsModuleKind

type JsModuleKind int32

JsModuleKind specifies the kind of the JS module.

const (
	// JS_MODULE_KIND_INVALID is the invalid value.
	JsModuleKind_JS_MODULE_KIND_INVALID JsModuleKind = 0
	// JS_MODULE_KIND_BACKEND indicates the module runs on the plugin backend.
	// The module should export a function matching the Plugin interface.
	JsModuleKind_JS_MODULE_KIND_BACKEND JsModuleKind = 1
	// JS_MODULE_KIND_FRONTEND indicates the module runs on the plugin frontend.
	// This usually means running within a WebView.
	JsModuleKind_JS_MODULE_KIND_FRONTEND JsModuleKind = 2
)

func (JsModuleKind) Enum

func (x JsModuleKind) Enum() *JsModuleKind

func (JsModuleKind) MarshalJSON

func (x JsModuleKind) MarshalJSON() ([]byte, error)

MarshalJSON marshals the JsModuleKind to JSON.

func (JsModuleKind) MarshalProtoJSON

func (x JsModuleKind) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the JsModuleKind to JSON.

func (JsModuleKind) MarshalProtoText

func (x JsModuleKind) MarshalProtoText() string

func (JsModuleKind) MarshalText

func (x JsModuleKind) MarshalText() ([]byte, error)

MarshalText marshals the JsModuleKind to text.

func (JsModuleKind) String

func (x JsModuleKind) String() string

func (*JsModuleKind) UnmarshalJSON

func (x *JsModuleKind) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the JsModuleKind from JSON.

func (*JsModuleKind) UnmarshalProtoJSON

func (x *JsModuleKind) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the JsModuleKind from JSON.

func (*JsModuleKind) UnmarshalText

func (x *JsModuleKind) UnmarshalText(b []byte) error

UnmarshalText unmarshals the JsModuleKind from text.

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

Jump to

Keyboard shortcuts

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