Documentation
¶
Index ¶
- Variables
- func ApplyTinyGoNodeFallbacks(opts *esbuild.BuildOptions)
- func BrowserBuildOpts(workingDir string, minify, sourcemaps bool) esbuild.BuildOptions
- func BrowserEntrypointBuildOpts(bldrDistRoot string, minify, sourcemaps bool) esbuild.BuildOptions
- func BuildRendererBundle(le *logrus.Entry, ...) ([]string, error)
- func BuildRendererIndex(buildDir, entrypointPath string, importMap web_entrypoint_index.ImportMap) error
- func BuildServiceWorkerBundle(le *logrus.Entry, bldrDistRoot, buildDir string, ...) (string, error)
- func BuildSharedWorkerBundle(le *logrus.Entry, bldrDistRoot, buildDir string, ...) (string, error)
- func BuildWebPkgsBundle(ctx context.Context, le *logrus.Entry, stateDir string, ...) (web_entrypoint_index.ImportMap, error)
- func DefaultBanner() map[string]string
- func ServiceWorkerBuildOpts(bldrDistRoot string, minify, sourcemaps, hash bool) esbuild.BuildOptions
- func SharedWorkerBuildOpts(bldrDistRoot string, minify, sourcemaps, hash bool) esbuild.BuildOptions
- func WriteBuildManifest(dir string, manifest *BuildManifest) error
- func WriteStableBootAsset(dir string) error
- type BrowserBundleResult
- type BuildManifest
Constants ¶
This section is empty.
Variables ¶
var EsbuildLogLevel = esbuild.LogLevelWarning
EsbuildLogLevel is the log level when bundling the bundle.
Functions ¶
func ApplyTinyGoNodeFallbacks ¶ added in v0.51.7
func ApplyTinyGoNodeFallbacks(opts *esbuild.BuildOptions)
ApplyTinyGoNodeFallbacks keeps TinyGo's browser wasm_exec.js Node fallbacks external so the injected browser stubs can provide runtime globals instead.
func BrowserBuildOpts ¶
func BrowserBuildOpts(workingDir string, minify, sourcemaps bool) esbuild.BuildOptions
BrowserBuildOpts are general options for building for the browser.
func BrowserEntrypointBuildOpts ¶
func BrowserEntrypointBuildOpts(bldrDistRoot string, minify, sourcemaps bool) esbuild.BuildOptions
BrowserEntrypointBuildOpts creates the BuildOpts for the root browser entrypoint
func BuildRendererBundle ¶
func BuildRendererBundle( le *logrus.Entry, sourcesRoot, bldrDistRoot, buildDir, runtimeJsPath, runtimeSwPath, runtimeShwPath, webStartupSrcPath, entrypointHash string, minify, sourcemaps, forceDedicatedWorkers, forceMessagePortWorkerComms, devMode bool, webPkgImportMap web_entrypoint_index.ImportMap, ) ([]string, error)
BuildRendererBundle builds the web renderer bundle files.
webStartupSrcPath is the path to the startup js module to load for the react app entrypoint (can be empty). entrypointHash, if set, builds into /entrypoint/{entrypointHash}/... BuildRendererBundle builds the web renderer bundle and returns CSS output paths relative to buildDir.
func BuildRendererIndex ¶
func BuildRendererIndex(buildDir, entrypointPath string, importMap web_entrypoint_index.ImportMap) error
BuildRendererIndex builds the web renderer index.html.
importMap contains the web pkg import map entries (from BuildWebPkgsBundle).
func BuildServiceWorkerBundle ¶
func BuildServiceWorkerBundle(le *logrus.Entry, bldrDistRoot, buildDir string, minify, sourcemaps, devMode bool) (string, error)
BuildServiceWorkerBundle builds specifically the service worker files.
Returns the filename of the service worker output file (including the hash).
func BuildSharedWorkerBundle ¶
func BuildSharedWorkerBundle(le *logrus.Entry, bldrDistRoot, buildDir string, minify, sourcemaps, devMode bool) (string, error)
BuildSharedWorkerBundle builds specifically the shared worker files.
Returns the filename of the shared worker output file (including the hash).
func BuildWebPkgsBundle ¶
func BuildWebPkgsBundle(ctx context.Context, le *logrus.Entry, stateDir string, plat bldr_platform.Platform, bldrDistRoot, buildDir, pathPrefix string, minify, sourcemaps, devMode bool) (web_entrypoint_index.ImportMap, error)
BuildWebPkgsBundle builds the web pkg bundle files.
stateDir is the directory where bun will be downloaded if not found in PATH. pathPrefix is the prefix to prepend to /pkgs/ for pkg paths Returns the import map entries mapping logical specifiers to hashed output paths.
func DefaultBanner ¶
DefaultBanner is the default banner applied to code files.
func ServiceWorkerBuildOpts ¶
func ServiceWorkerBuildOpts(bldrDistRoot string, minify, sourcemaps, hash bool) esbuild.BuildOptions
ServiceWorkerBuildOpts creates the BuildOpts for the service worker
func SharedWorkerBuildOpts ¶
func SharedWorkerBuildOpts(bldrDistRoot string, minify, sourcemaps, hash bool) esbuild.BuildOptions
SharedWorkerBuildOpts creates the BuildOpts for the shared worker
func WriteBuildManifest ¶
func WriteBuildManifest(dir string, manifest *BuildManifest) error
WriteBuildManifest writes a manifest.json to the given directory.
func WriteStableBootAsset ¶
WriteStableBootAsset writes the stable browser boot asset at the build root.
Types ¶
type BrowserBundleResult ¶
type BrowserBundleResult struct {
// EntrypointPath is the path to the entrypoint mjs relative to the build dir.
EntrypointPath string
// ServiceWorkerFilename is the output filename of the service worker.
ServiceWorkerFilename string
SharedWorkerFilename string
// CSSPaths contains CSS output file paths relative to the build dir.
CSSPaths []string
}
BrowserBundleResult contains the output filenames from a browser bundle build.
func BuildBrowserBundle ¶
func BuildBrowserBundle( ctx context.Context, le *logrus.Entry, stateDir, sourcesRoot, bldrDistRoot, buildDir, runtimeJsPath, runtimeSwPath, runtimeShwPath, webStartupSrcPath string, entrypointHash string, minify, sourcemaps, devMode, forceDedicatedWorkers, forceMessagePortWorkerComms bool, ) (*BrowserBundleResult, error)
BuildBrowserBundle builds and outputs the web & service worker files.
stateDir is the directory where bun will be downloaded if not found in PATH. webStartupSrcPath is the path to the startup js module to load for the react app entrypoint (can be empty). entrypointHash, if set, builds into /entrypoint/{entrypointHash}/...
type BuildManifest ¶
type BuildManifest struct {
Entrypoint string `json:"entrypoint"`
ServiceWorker string `json:"serviceWorker"`
Wasm string `json:"wasm"`
CSS []string `json:"css"`
}
BuildManifest is the manifest.json structure written alongside index.html. The prerender build script reads this to discover asset URLs.