Documentation
¶
Index ¶
- func BuildImportMapFromEntries(entries []ImportMapEntry) web_entrypoint_index.ImportMap
- func RunOneShot(ctx context.Context, le *logrus.Entry, distSourcePath string, ...) error
- type ImportMapEntry
- func BuildWebPkgsVite(ctx context.Context, le *logrus.Entry, codeRootPath string, ...) (webPkgIDs, sourcePaths []string, importMapEntries []ImportMapEntry, err error)
- func BuildWebPkgsViteWithManagedRoot(ctx context.Context, le *logrus.Entry, codeRootPath string, ...) (webPkgIDs, sourcePaths []string, importMapEntries []ImportMapEntry, err error)
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.