Before this commit, src/renderer/flowchart-bundle.js was a 1700+
line hand-maintained file with ~1100 lines of inlined copies of the
pure modules (shapes, mermaid, mermaid-parse, store, canvas,
clipboard, align). Every change to a pure module required a manual
re-sync, and the C17 multi-select commit had to be applied in two
places — drift between source and bundle was a real risk.
This refactor introduces scripts/build-flowchart-bundle.js that
reads each pure module from src/flowchart/ and concatenates them
into the final src/renderer/flowchart-bundle.js that the standalone
window loads as a single <script> tag.
Architecture:
- src/renderer/flowchart-bundle.js — now auto-generated, gitignored
only conceptually (still tracked so the standalone window works
without running a build step in dev).
- src/renderer/flowchart-bundle-tail.js — the unique code that
was previously buried in the middle of the hand-maintained bundle:
IIFE open, defensive checks, pure-module destructure, controller
bootstrap, modal helpers, node-list panel, closing IIFE, and
DOMContentLoaded bootstrap trigger.
- scripts/build-flowchart-bundle.js — the generator. Reads 8 pure
modules in dependency order (vsdx-export excluded — main-process
only), wraps each in its own IIFE for scope isolation, rewrites
canvas's CommonJS require() lines to use window globals, and
rewrites bare 'module.exports = X' to 'window.FlowchartX = X'
for modules without UMD guards.
Tests: 1386/1386 passing (no regressions). The pre-existing per-node
fill color test that was passing before now passes for the right
reason — the canvas source was updated to pass node.color through
to shapeSvg, which it always should have. The hand-maintained bundle
had been silently carrying a patched version that passed color but
was never backported to src/.
Amit Haridas