Commit Graph

8 Commits

Author SHA1 Message Date
yz-yu
6fad7f642c record canvas mutations (#296)
* record canvas mutations

close #60, #261

This patch implements the canvas mutation observer.
It consists of both the record and the replay side changes.

In the record side, we add a `recordCanvas` flag to indicate
whether to record canvas elements and the flag defaults to false.
Different from our other observers, the canvas observer was
disabled by default. Because some applications with heavy canvas
usage may emit a lot of data as canvas changed, especially the
scenarios that use a lot of `drawImage` API.
So the behavior should be audited by users and only record canvas
when the flag was set to true.

In the replay side, we add a `UNSAFE_replayCanvas` flag to indicate
whether to replay canvas mutations.
Similar to the `recordCanvas` flag, `UNSAFE_replayCanvas` defaults
to false. But unlike the record canvas implementation is stable and
safe, the replay canvas implementation is UNSAFE.
It's unsafe because we need to add `allow-scripts` to the replay
sandbox, which may cause some unexpected script execution. Currently,
users should be aware of this implementation detail and enable this
feature carefully.

* update canvas integration test
2026-04-01 12:00:00 +08:00
Yanzhen Yu
eb29b74281 repl: reset events when start and add types to inquirer prompt 2026-04-01 12:00:00 +08:00
Rongjian Zhang
09117796bd REPL tool enhancement (#21)
* exit after record saved

* refactor: use inquirer instead of low level readline

* feat: ask user if record another one, instead of exit
2026-04-01 12:00:00 +08:00
Yanzhen Yu
df990cd731 fix script tag in repl mode 2026-04-01 12:00:00 +08:00
Yanzhen Yu
0995b7a6d3 basic impl of wait for stylesheet loaded 2026-04-01 12:00:00 +08:00
Yanzhen Yu
142c38e5a5 update dependency 2026-04-01 12:00:00 +08:00
Yanzhen Yu
3e1ef6825e add sourcemap for terser bundles 2026-04-01 12:00:00 +08:00
Yanzhen Yu
b065b22f09 refactor the repl tool to support multipage apps and better dev 2026-04-01 12:00:00 +08:00