* fix(js): serialize dynamic module imports + re-land base href for SPA lazy chunks (#246)
Add a serialized import queue (__dynScriptQueue + __processDynScriptQueue)
in bootstrap.js so that dynamically inserted <script module> tags execute
one at a time rather than concurrently. This prevents re-entrant RefCell
panics in deno_core's futures_unordered_driver when SPAs (Angular, etc.)
append multiple lazy chunks at once.
Also re-land dynamic import <base href> resolution (previously reverted
as 88af239). The original panic was caused by concurrency, not the URL
resolution logic — now safe because imports are serialized.
Inline module scripts also route through the same queue for consistency.
Fixes#246Closes#242 (dynamic import base href)
* Fix base-href resolution, queue wedge, and double-fired load event
- Resolve <base href> to an absolute URL before resolving the script src, and
guard the new URL() call. A path-only base like <base href="/"> (the standard
Angular form) was passed raw to new URL(src, base), which threw "Invalid URL"
out of appendChild and broke the SPAs this change targets.
- Wrap the dynamic-script queue drain in try/finally so __dynScriptBusy is always
cleared. An unexpected throw used to wedge the queue and silently block every
later dynamic script on the page.
- Fire load/error through dispatchEvent only. dispatchEvent already invokes the
element's onload property handler, so the extra explicit onload() call
double-fired it. This also drops the stale enqueue-time callback snapshot and
reads handlers live off the element.
---------
Co-authored-by: SGavrl <[email protected]>