fc8918c1f91bad9df7fe3644d782e88d1602fe9f
Review found a gap in the idempotency marker added for Task 16: if external code wraps our patched console.error between two of our own installs, the marker sees an unmarked function and treats it as virgin, capturing the external wrapper itself as "the original". That both double-records (the old patch is still reachable inside the wrapper's closure) and makes __resetConsoleErrorBuffer() restore to the wrapper instead of the real original. Fix: stash the true original exactly once, directly on the `console` object (not module scope, so it survives HMR too), and always re-wrap that stashed reference rather than whatever console.error currently is. Reinstalling after an external wrap now discards that wrapper instead of guessing whether it still chains to us -- a deliberate, documented trade-off, since there is no safe way to tell those two cases apart from the outside. Also: window error/rejection listeners now catch exceptions from a hostile e.reason the same way the console.error patch already did, and the module doc comment now notes the known HMR buffer-orphan wrinkle. Adds two tests covering the external-wrapper and module-re-execution scenarios; both were mutation-verified to fail against the prior implementation. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Description
Visual drag-and-drop website builder using GrapesJS
3.5 MiB
Languages
TypeScript
64.8%
HTML
16.1%
JavaScript
14.9%
CSS
3.2%
PHP
0.7%
Other
0.3%