Help us shape the future of Go! Take the 2026 Go Developer Survey

web_pkg_vite

package
v0.57.21 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildImportMapFromEntries

func BuildImportMapFromEntries(entries []ImportMapEntry) web_entrypoint_index.ImportMap

BuildImportMapFromEntries assembles an ImportMap from the collected import map entries produced by BuildWebPkgsVite. Each entry maps a logical specifier (e.g. "react") to a hashed output path (e.g. "/b/pkg/react/index-a1b2c3.mjs").

func RunOneShot

func RunOneShot(
	ctx context.Context,
	le *logrus.Entry,
	distSourcePath string,
	sourcePath string,
	workingPath string,
	fn func(ctx context.Context, client bldr_vite.SRPCViteBundlerClient) error,
) error

RunOneShot starts a ViteBundler process, calls the provided function with the client, and tears down the process when done. Use this for call sites that do not have a long-lived ViteBundler process (esbuild compiler, plugin compiler, browser entrypoint).

Types

type ImportMapEntry

type ImportMapEntry struct {
	// Specifier is the logical import specifier (e.g. "react", "react/jsx-runtime").
	Specifier string
	// OutputPath is the hashed output filename (e.g. "index-a1b2c3.mjs").
	OutputPath string
}

ImportMapEntry is an entry mapping a logical import specifier to a hashed output path.

func BuildWebPkgsVite

func BuildWebPkgsVite(
	ctx context.Context,
	le *logrus.Entry,
	codeRootPath string,
	webPkgsRefs []*web_pkg.WebPkgRef,
	outputPath string,
	webPkgBasePath string,
	isRelease bool,
	jsMinification bool,
	jsSourcemaps bool,
	viteBundler bldr_vite.SRPCViteBundlerClient,
	cacheDir string,
) (webPkgIDs, sourcePaths []string, importMapEntries []ImportMapEntry, err error)

BuildWebPkgsVite builds web packages using the ViteBundler SRPC service.

Has the same return signature as BuildWebPkgsEsbuild: web pkg IDs, source file paths, and an error. Additionally returns import map entries mapping logical specifiers to hashed output filenames.

func BuildWebPkgsViteWithManagedRoot added in v0.57.2

func BuildWebPkgsViteWithManagedRoot(
	ctx context.Context,
	le *logrus.Entry,
	codeRootPath string,
	managedRootPath string,
	webPkgsRefs []*web_pkg.WebPkgRef,
	providedWebPkgIDs []string,
	outputPath string,
	webPkgBasePath string,
	isRelease bool,
	jsMinification bool,
	jsSourcemaps bool,
	viteBundler bldr_vite.SRPCViteBundlerClient,
	cacheDir string,
) (webPkgIDs, sourcePaths []string, importMapEntries []ImportMapEntry, err error)

BuildWebPkgsViteWithManagedRoot builds web packages without retaining compiler-managed files as durable source provenance.

providedWebPkgIDs lists web packages other plugins provide. Imports of them stay external and resolve to their /b/pkg/ URLs, like sibling packages.

Jump to

Keyboard shortcuts

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