begin new custom chart implementation for js ui

This commit is contained in:
2026-07-16 11:45:17 -04:00
parent 13a60a90a1
commit 550e97aa9b
21 changed files with 1001 additions and 179 deletions

View File

@@ -26,10 +26,12 @@ func esbuildDefine() map[string]string {
}
// resolveEntryPoint returns the path (relative to frontendDir) of the
// SPA entry point, preferring app.tsx over app.js.
// SPA entry point, preferring app.tsx, then app.ts, then app.js.
func resolveEntryPoint() string {
if _, err := os.Stat(filepath.Join(frontendDir, "src/app.tsx")); err == nil {
return "src/app.tsx"
for _, e := range []string{"src/app.tsx", "src/app.ts"} {
if _, err := os.Stat(filepath.Join(frontendDir, e)); err == nil {
return e
}
}
return "src/app.js"
}
@@ -79,8 +81,16 @@ func bundleJSEntry(entry, outName string) (bundleStats, error) {
plugins := []esbuild.Plugin{aliasPlugin(), defaultExportShimPlugin(), Plugin()}
plugins = append(plugins, assetURLPlugin(), vendorManifestPlugin(entrypoints, vdirs))
// esbuild wants forward slashes and a leading "./"; a relative path with the
// OS separator (filepath.Join gives backslashes on Windows) or without "./" is
// read as a bare package specifier and fails to resolve.
entryPath := filepath.ToSlash(entry)
if !filepath.IsAbs(entry) && !strings.HasPrefix(entryPath, "./") && !strings.HasPrefix(entryPath, "../") {
entryPath = "./" + entryPath
}
result := esbuild.Build(esbuild.BuildOptions{
EntryPoints: []string{entry},
EntryPoints: []string{entryPath},
Outfile: filepath.Join(outputDir, outName),
Bundle: true,
Write: true,