Skip to content

Auto-detect esbuild for v13+ branches#113

Merged
goransle merged 2 commits intomasterfrom
v13-esbuild-detection
Apr 29, 2026
Merged

Auto-detect esbuild for v13+ branches#113
goransle merged 2 commits intomasterfrom
v13-esbuild-detection

Conversation

@goransle
Copy link
Copy Markdown
Member

Summary

Automatically detect and enable esbuild mode for Highcharts v13+ branches by checking for the presence of ts/masters/highcharts-autoload.src.ts on the branch.

Changes

  • Added branchNeedsEsbuild() function that performs a GitHub HEAD request to detect v13+ branches
  • Fixed bug where single-segment branch names weren't stripped from URLs when resolved to commit SHA
  • Anchored URL .replace() calls to path segment boundaries to prevent filename corruption
  • Refactored response handling into respondToClient for consistency
  • Updated @highcharts/highcharts-utils dependency
  • Added comprehensive test coverage

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds automatic esbuild enablement for newer Highcharts branches (v13+) by probing the branch for the presence of ts/masters/highcharts-autoload.src.ts, and updates tests/docs to reflect the new behavior.

Changes:

  • Add branchNeedsEsbuild() detection (GitHub HEAD request) and auto-enable esbuild in handlerDefault when appropriate.
  • Tighten URL SHA-rewrite logic to replace only full path segments (avoid filename corruption) and fix single-segment branch rewrite behavior.
  • Add/adjust unit + Hurl integration tests and update documentation; bump @highcharts/highcharts-utils.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
app/handlers.js Adds esbuild auto-detection + caching and updates URL rewriting before serving/building.
README.md Documents automatic esbuild behavior for v13+ and how to verify via headers.
test/esbuild.js Extends unit coverage for autoload + data-sorting paths/configs.
test/hurl/smoke.hurl Adds basic local smoke check.
test/hurl/esbuild-autoload.hurl Adds integration checks for esbuild compilation + auto-detection.
test/hurl/dashboards.hurl Adds integration checks for dashboards endpoints.
test.hurl Points users to the new test/hurl/*.hurl layout.
package.json Pins @highcharts/highcharts-utils to a GitHub branch.
package-lock.json Updates lockfile for dependency changes.

Comment thread app/handlers.js
Comment on lines +44 to +45
const esbuildCache = new Map()
const ESBUILD_DETECTION_FILE = 'ts/masters/highcharts-autoload.src.ts'
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

esbuildCache is an unbounded Map and will grow indefinitely with unique refs/SHAs, which can become a long-lived memory leak in a server process. Consider switching to a bounded LRU/TTL cache (e.g., cap entries and/or expire after N minutes), or only caching for known branch names (not every commit SHA).

Copilot uses AI. Check for mistakes.
Comment thread test/hurl/dashboards.hurl
Comment thread package.json
},
"devDependencies": {
"@highcharts/highcharts-utils": "github:highcharts/highcharts-utils",
"@highcharts/highcharts-utils": "github:highcharts/highcharts-utils#fix/uniquekey-compile-on-demand",
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pinning @highcharts/highcharts-utils to a moving branch (#fix/uniquekey-compile-on-demand) makes installs non-reproducible and can unexpectedly change behavior over time. Consider pinning to a specific commit SHA or a tagged release, and documenting why this fork/branch is required.

Suggested change
"@highcharts/highcharts-utils": "github:highcharts/highcharts-utils#fix/uniquekey-compile-on-demand",
"@highcharts/highcharts-utils": "github:highcharts/highcharts-utils#<full-commit-sha-for-the-required-fix>",

Copilot uses AI. Check for mistakes.
@goransle goransle merged commit 28f3a5b into master Apr 29, 2026
1 check passed
@goransle goransle deleted the v13-esbuild-detection branch April 29, 2026 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants