entrypoint_electron_bundle

package
v0.56.1 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EsbuildLogLevel = esbuild.LogLevelWarning

EsbuildLogLevel is the log level when bundling the electron entrypoint_browser_bundle.

Functions

func ApplyDevBranding

func ApplyDevBranding(
	ctx context.Context,
	le *logrus.Entry,
	electronDistPath string,
	stateDir string,
	plat bldr_platform.Platform,
	appName string,
	iconPath string,
) (string, error)

ApplyDevBranding applies NativeAppConfig branding to an extracted Electron.

electronDistPath is the directory containing the extracted Electron. stateDir is used for downloading tools (resedit-cli on Windows). appName is the display name from NativeAppConfig.AppName. iconPath is the absolute path to the source icon PNG (empty to skip icon).

Returns the new electron binary path relative to electronDistPath. Idempotent: skips if marker file matches appName.

func BuildAsar

func BuildAsar(ctx context.Context, le *logrus.Entry, stateDir, buildDir, outPath string) error

BuildAsar builds the app asar using the @electron/asar tool.

stateDir is the directory where bun will be downloaded if not found in PATH. buildDir should be pre-prepared using BuildElectronBundle. outPath should be the path to the output .asar file

func BuildElectronBundle

func BuildElectronBundle(ctx context.Context, le *logrus.Entry, stateDir, bldrDistRoot, buildDir, startupFilename string, minify, devMode bool) error

BuildElectronBundle builds and outputs the web & service worker files.

stateDir is the directory where bun will be downloaded if not found in PATH. startupFilename is the path to the react component to load on startup (can be empty). minify enables file minification in esbuild devMode enables devMode extensions in Electron entrypointHash, if set, uses /entrypoint/{entrypointHash}/pkgs/...

func BuildElectronRendererIndex added in v0.51.8

func BuildElectronRendererIndex(buildDir string, importMap web_entrypoint_index.ImportMap) error

func BuildMainBundle

func BuildMainBundle(le *logrus.Entry, bldrDistRoot, buildDir string, minify, devMode bool) error

BuildMainBundle builds the electron Main bundle files.

func BuildPreloadBundle

func BuildPreloadBundle(le *logrus.Entry, bldrDistRoot, buildDir string, minify, devMode bool) error

BuildPreloadBundle builds the web renderer bundle files.

func BuildRendererBundle

func BuildRendererBundle(
	ctx context.Context,
	le *logrus.Entry,
	bldrDistRoot,
	buildDir,
	runtimeJsPath,
	runtimeSwPath,
	runtimeShwPath,
	webStartupSrcPath string,
	minify,
	devMode bool,
) error

BuildRendererBundle builds the web renderer bundle files.

runtimeSwPath is the path to the service worker js for the entrypoint to load. runtimeShwPath is the path to the service worker js for the entrypoint to load. webStartupSrcPath is the path to the startup js module to load for the react app entrypoint (can be empty).

func BuildServiceWorkerBundle

func BuildServiceWorkerBundle(le *logrus.Entry, bldrDistRoot, buildDir string, minify, devMode bool) (string, error)

BuildServiceWorkerBundle builds specifically the service worker files.

Returns the path to the service worker .mjs file

func BuildServiceWorkerBundleWithRuntimeDeps added in v0.52.0

func BuildServiceWorkerBundleWithRuntimeDeps(le *logrus.Entry, bldrDistRoot, buildDir, buildPkgsDir string, minify, devMode bool) (string, error)

func DownloadElectronRedist

func DownloadElectronRedist(ctx context.Context, le *logrus.Entry, stateDir string, plat bldr_platform.Platform, buildDir, destDir string, npmPkg string) error

DownloadElectronRedist downloads the electron redistributable to the destination dir.

stateDir is the directory where bun will be downloaded if not found in PATH. If npmPkg is empty, defaults to latest.

When plat is a NativePlatform whose goos/goarch differ from the host, npm_config_* and ELECTRON_INSTALL_* are set so Electron's installer fetches the target redistributable instead of the host's. Without this, cross-platform release builds land with a host-arch electron in dist/, which then fails downstream branding / packaging steps that expect target-arch layout.

func ElectronBuildOpts

func ElectronBuildOpts(bldrDistRoot string, minify, devMode bool) esbuild.BuildOptions

ElectronBuildOpts are general options for building for Electron.

func ElectronDefine

func ElectronDefine(devMode bool) map[string]string

ElectronDefine returns the define mapping for Electron.

devMode enables devMode mode.

func FixEsbuildIssue1921

func FixEsbuildIssue1921(opts *esbuild.BuildOptions)

FixEsbuildIssue1921 fixes dynamic esbuild imports failing under node.js.

https://github.com/evanw/esbuild/issues/1921

func GetElectronBinName

func GetElectronBinName(plat bldr_platform.Platform) string

GetElectronBinName returns the name of the electron binary.

Returns just "electron" if not known.

func WriteElectronStableBootFiles added in v0.51.8

func WriteElectronStableBootFiles(buildDir, serviceWorkerFilename, sharedWorkerFilename string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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