rrweb-io / rrweb

record and replay the web
https://www.rrweb.io/
MIT License
15.9k stars 1.38k forks source link

Reverse monkey patch built in methods to support LWC #1509

Open Juice10 opened 3 weeks ago

Juice10 commented 3 weeks ago

LWC monkey patches a lot of built in methods.

This PR gets around that issue by pulling new references from a temporary iframe, which hasn't been monkey patched yet.

changeset-bot[bot] commented 3 weeks ago

🦋 Changeset detected

Latest commit: 54e33aef89d600c1c452db308fd98db5a150c47e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 19 packages | Name | Type | | ---------------------------------------- | ----- | | rrweb-snapshot | Patch | | rrweb | Patch | | @rrweb/utils | Patch | | rrdom | Patch | | rrdom-nodejs | Patch | | rrweb-player | Patch | | @rrweb/all | Patch | | @rrweb/replay | Patch | | @rrweb/record | Patch | | @rrweb/types | Patch | | @rrweb/packer | Patch | | @rrweb/web-extension | Patch | | rrvideo | Patch | | @rrweb/rrweb-plugin-console-record | Patch | | @rrweb/rrweb-plugin-console-replay | Patch | | @rrweb/rrweb-plugin-sequential-id-record | Patch | | @rrweb/rrweb-plugin-sequential-id-replay | Patch | | @rrweb/rrweb-plugin-canvas-webrtc-record | Patch | | @rrweb/rrweb-plugin-canvas-webrtc-replay | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

eoghanmurray commented 2 weeks ago

I've asked a SO question here to see if there are any ideas on how we might achieve the goals of this PR with less invasive code changes: https://stackoverflow.com/questions/78633141/typescript-transform-property-to-function-call

Could we add a new (optional) output target, which pulls in the added functions, and also includes a rollup plugin to find/replace all the needed property accesses?

https://www.npmjs.com/package/rollup-plugin-modify#example-using-regexp-for-find-and-a-function-for-replace

eoghanmurray commented 2 weeks ago

From SO, the first replier mentions https://www.npmjs.com/package/ts-patch I haven't looked at it, but maybe would work better than a regex solution

Juice10 commented 1 week ago

I've asked a SO question here to see if there are any ideas on how we might achieve the goals of this PR with less invasive code changes: https://stackoverflow.com/questions/78633141/typescript-transform-property-to-function-call

Could we add a new (optional) output target, which pulls in the added functions, and also includes a rollup plugin to find/replace all the needed property accesses?

https://www.npmjs.com/package/rollup-plugin-modify#example-using-regexp-for-find-and-a-function-for-replace

I agree that it would be really nice if we could use some sort of general purpose solution to rewrite this out of the box. Currently we have a couple things that make this difficult: