-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: upgrade rrweb to alpha.16 #1276
Merged
+206
−352
Merged
Changes from 2 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
4d55234
chore: upgrade rrweb to alpha.16
daibhin 858c900
add patches
daibhin 5a9c55c
await not yield
daibhin 936a040
update imports
daibhin d8a367c
readd types
daibhin 1c52fa2
add necessary package
daibhin bc298a5
fix import issues
daibhin 9b953af
include tsc check
daibhin 84acf2d
move to dev dependency
daibhin 625b3db
fix patching
daibhin 99e86e1
Merge branch 'main' into dn-chore/upgrade-rrweb
daibhin 9a48218
Merge branch 'main' into dn-chore/upgrade-rrweb
daibhin 869db07
fix typescript error on rrwebs end (https://rrweb.slack.com/archives/…
daibhin d690015
Merge branch 'main' into dn-chore/upgrade-rrweb
daibhin c8244ea
add comment
daibhin 2f31e1c
Merge branch 'main' into dn-chore/upgrade-rrweb
pauldambra 7b07766
Merge branch 'main' into dn-chore/upgrade-rrweb
daibhin e964112
Merge branch 'main' into dn-chore/upgrade-rrweb
daibhin b0e022d
Merge branch 'main' into dn-chore/upgrade-rrweb
daibhin d064109
Merge branch 'main' into dn-chore/upgrade-rrweb
daibhin 5dcf91a
remove dodgy function
daibhin 4867257
remove old patch
daibhin c41a808
Merge branch 'main' into dn-chore/upgrade-rrweb
daibhin 59a3d08
Merge branch 'main' into dn-chore/upgrade-rrweb
daibhin b6f2a18
Merge branch 'main' into dn-chore/upgrade-rrweb
daibhin 9245c9e
Merge branch 'main' into dn-chore/upgrade-rrweb
daibhin 40e0f7d
Merge branch 'main' into dn-chore/upgrade-rrweb
daibhin 0f7dc10
Merge branch 'main' into dn-chore/upgrade-rrweb
pauldambra 1284fef
Merge branch 'main' into dn-chore/upgrade-rrweb
daibhin 4facee8
fix variable names
daibhin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,7 +49,7 @@ | |
"@rollup/plugin-node-resolve": "^15.2.3", | ||
"@rollup/plugin-terser": "^0.4.4", | ||
"@rollup/plugin-typescript": "^11.1.6", | ||
"@rrweb/types": "2.0.0-alpha.13", | ||
"@rrweb/types": "2.0.0-alpha.16", | ||
"@sentry/types": "8.7.0", | ||
"@testing-library/dom": "^9.3.0", | ||
"@testing-library/jest-dom": "^6.4.5", | ||
|
@@ -94,8 +94,8 @@ | |
"rollup": "^4.9.6", | ||
"rollup-plugin-dts": "^6.1.0", | ||
"rollup-plugin-visualizer": "^5.12.0", | ||
"rrweb": "2.0.0-alpha.13", | ||
"rrweb-snapshot": "2.0.0-alpha.13", | ||
"rrweb": "2.0.0-alpha.16", | ||
"rrweb-snapshot": "2.0.0-alpha.16", | ||
"sinon": "9.0.2", | ||
"testcafe": "1.19.0", | ||
"testcafe-browser-provider-browserstack": "1.14.0", | ||
|
@@ -116,7 +116,7 @@ | |
], | ||
"pnpm": { | ||
"patchedDependencies": { | ||
"[email protected].13": "patches/[email protected].13.patch" | ||
"[email protected].16": "patches/[email protected].16.patch" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,74 @@ | ||||||||||||||||||||||||||||||||||||||||
diff --git a/dist/rrweb.js b/dist/rrweb.js | ||||||||||||||||||||||||||||||||||||||||
index 1db2d08b2fe9a73521001c3aa88b1a64d1b3e71a..a9a473fca25eeec5c6794c4806baffe2d1bc1e15 100644 | ||||||||||||||||||||||||||||||||||||||||
--- a/dist/rrweb.js | ||||||||||||||||||||||||||||||||||||||||
+++ b/dist/rrweb.js | ||||||||||||||||||||||||||||||||||||||||
@@ -661,9 +661,17 @@ function serializeElementNode(n2, options) { | ||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||
if (tagName === "link" && inlineStylesheet) { | ||||||||||||||||||||||||||||||||||||||||
- const stylesheet = Array.from(doc.styleSheets).find((s2) => { | ||||||||||||||||||||||||||||||||||||||||
- return s2.href === n2.href; | ||||||||||||||||||||||||||||||||||||||||
- }); | ||||||||||||||||||||||||||||||||||||||||
+ function findStylesheet(href) { | ||||||||||||||||||||||||||||||||||||||||
+ return Array.from(doc.styleSheets).find((s2) => { | ||||||||||||||||||||||||||||||||||||||||
+ return s2.href === href; | ||||||||||||||||||||||||||||||||||||||||
+ }); | ||||||||||||||||||||||||||||||||||||||||
+ } | ||||||||||||||||||||||||||||||||||||||||
+ let stylesheet = findStylesheet(n2.href); | ||||||||||||||||||||||||||||||||||||||||
+ if (!stylesheet && href.includes('.css')) { | ||||||||||||||||||||||||||||||||||||||||
+ const stylesheetPath = href.replace(window.location.href, ''); | ||||||||||||||||||||||||||||||||||||||||
+ const potentialStylesheetHref = window.location.origin + '/' + stylesheetPath; | ||||||||||||||||||||||||||||||||||||||||
+ stylesheet = findStylesheet(potentialStylesheetHref); | ||||||||||||||||||||||||||||||||||||||||
+ } | ||||||||||||||||||||||||||||||||||||||||
let cssText = null; | ||||||||||||||||||||||||||||||||||||||||
if (stylesheet) { | ||||||||||||||||||||||||||||||||||||||||
cssText = stringifyStylesheet(stylesheet); | ||||||||||||||||||||||||||||||||||||||||
@@ -5016,11 +5024,19 @@ class CanvasManager { | ||||||||||||||||||||||||||||||||||||||||
let rafId; | ||||||||||||||||||||||||||||||||||||||||
const getCanvas = () => { | ||||||||||||||||||||||||||||||||||||||||
const matchedCanvas = []; | ||||||||||||||||||||||||||||||||||||||||
- win.document.querySelectorAll("canvas").forEach((canvas) => { | ||||||||||||||||||||||||||||||||||||||||
- if (!isBlocked(canvas, blockClass, blockSelector, true)) { | ||||||||||||||||||||||||||||||||||||||||
- matchedCanvas.push(canvas); | ||||||||||||||||||||||||||||||||||||||||
- } | ||||||||||||||||||||||||||||||||||||||||
- }); | ||||||||||||||||||||||||||||||||||||||||
+ const searchCanvas = (root) => { | ||||||||||||||||||||||||||||||||||||||||
+ root.querySelectorAll('canvas').forEach((canvas) => { | ||||||||||||||||||||||||||||||||||||||||
+ if (!isBlocked(canvas, blockClass, blockSelector, true)) { | ||||||||||||||||||||||||||||||||||||||||
+ matchedCanvas.push(canvas); | ||||||||||||||||||||||||||||||||||||||||
+ } | ||||||||||||||||||||||||||||||||||||||||
+ }); | ||||||||||||||||||||||||||||||||||||||||
+ root.querySelectorAll('*').forEach((elem) => { | ||||||||||||||||||||||||||||||||||||||||
+ if (elem.shadowRoot) { | ||||||||||||||||||||||||||||||||||||||||
+ searchCanvas(elem.shadowRoot); | ||||||||||||||||||||||||||||||||||||||||
+ } | ||||||||||||||||||||||||||||||||||||||||
+ }); | ||||||||||||||||||||||||||||||||||||||||
+ }; | ||||||||||||||||||||||||||||||||||||||||
+ searchCanvas(win.document); | ||||||||||||||||||||||||||||||||||||||||
return matchedCanvas; | ||||||||||||||||||||||||||||||||||||||||
}; | ||||||||||||||||||||||||||||||||||||||||
const takeCanvasSnapshots = (timestamp) => { | ||||||||||||||||||||||||||||||||||||||||
@@ -5041,13 +5057,20 @@ class CanvasManager { | ||||||||||||||||||||||||||||||||||||||||
context.clear(context.COLOR_BUFFER_BIT); | ||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||
- const bitmap = await createImageBitmap(canvas); | ||||||||||||||||||||||||||||||||||||||||
+ // createImageBitmap throws if resizing to 0 | ||||||||||||||||||||||||||||||||||||||||
+ // Fallback to intrinsic size if canvas has not yet rendered | ||||||||||||||||||||||||||||||||||||||||
+ const width = canvas.clientWidth || canvas.width; | ||||||||||||||||||||||||||||||||||||||||
+ const height = canvas.clientHeight || canvas.height; | ||||||||||||||||||||||||||||||||||||||||
+ const bitmap = yield createImageBitmap(canvas, { | ||||||||||||||||||||||||||||||||||||||||
+ resizeWidth: width, | ||||||||||||||||||||||||||||||||||||||||
+ resizeHeight: height | ||||||||||||||||||||||||||||||||||||||||
+ }); | ||||||||||||||||||||||||||||||||||||||||
worker.postMessage( | ||||||||||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||||||||||
id, | ||||||||||||||||||||||||||||||||||||||||
bitmap, | ||||||||||||||||||||||||||||||||||||||||
- width: canvas.width, | ||||||||||||||||||||||||||||||||||||||||
- height: canvas.height, | ||||||||||||||||||||||||||||||||||||||||
+ width: width, | ||||||||||||||||||||||||||||||||||||||||
+ height: height, | ||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replaces posthog-js/patches/[email protected] Lines 204 to 222 in 27b044c
|
||||||||||||||||||||||||||||||||||||||||
dataURLOptions: options.dataURLOptions | ||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||
[bitmap] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaces
posthog-js/patches/[email protected]
Lines 234 to 247 in 27b044c