Skip to content
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

Open
wants to merge 30 commits into
base: main
Choose a base branch
from
Open

chore: upgrade rrweb to alpha.16 #1276

wants to merge 30 commits into from

Conversation

daibhin
Copy link
Contributor

@daibhin daibhin commented Jun 26, 2024

Changes

rrweb moved to vite bundling so the patch file will look different this time around

Previous patch file: https:/PostHog/posthog-js/blob/v1.141.4/patches/rrweb%402.0.0-alpha.13.patch


I skipped the patch replacing the inline worker with the base64 worker

+++ b/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js
@@ -0,0 +1,31 @@
+function decodeBase64(base64, enableUnicode) {
+ var binaryString = atob(base64);
+ if (enableUnicode) {
+ var binaryView = new Uint8Array(binaryString.length);
+ for (var i = 0, n = binaryString.length; i < n; ++i) {
+ binaryView[i] = binaryString.charCodeAt(i);
+ }
+ return String.fromCharCode.apply(null, new Uint16Array(binaryView.buffer));
+ }
+ return binaryString;
+}
+
+function createURL(base64, sourcemapArg, enableUnicodeArg) {
+ var sourcemap = sourcemapArg === undefined ? null : sourcemapArg;
+ var enableUnicode = enableUnicodeArg === undefined ? false : enableUnicodeArg;
+ var source = decodeBase64(base64, enableUnicode);
+ var start = source.indexOf('\n', 10) + 1;
+ var body = source.substring(start) + (sourcemap ? '\/\/# sourceMappingURL=' + sourcemap : '');
+ var blob = new Blob([body], { type: 'application/javascript' });
+ return URL.createObjectURL(blob);
+}
+
+function createBase64WorkerFactory(base64, sourcemapArg, enableUnicodeArg) {
+ var url;
+ return function WorkerFactory(options) {
+ url = url || createURL(base64, sourcemapArg, enableUnicodeArg);
+ return new Worker(url, options);
+ };
+}
+
+export { createBase64WorkerFactory };
\ No newline at end of file
diff --git a/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createInlineWorkerFactory.js b/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createInlineWorkerFactory.js
deleted file mode 100644
index b39a7674a500ec96f95aa70dde959901bb964de7..0000000000000000000000000000000000000000
diff --git a/es/rrweb/_virtual/image-bitmap-data-url-worker.js b/es/rrweb/_virtual/image-bitmap-data-url-worker.js
index ea868845c4fad3276aa8e5f74abfd3568b466d11..965505de44975e718d431a4e9a62e753e4842158 100644
--- a/es/rrweb/_virtual/image-bitmap-data-url-worker.js
+++ b/es/rrweb/_virtual/image-bitmap-data-url-worker.js
@@ -1,120 +1,6 @@
-import { createInlineWorkerFactory } from './_rollup-plugin-web-worker-loader__helper__browser__createInlineWorkerFactory.js';
+import { createBase64WorkerFactory } from './_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js';
-var WorkerFactory = createInlineWorkerFactory(/* rollup-plugin-web-worker-loader */function () {
-(function () {
- '__worker_loader_strict__';
-
- /*! *****************************************************************************
- Copyright (c) Microsoft Corporation.
-
- Permission to use, copy, modify, and/or distribute this software for any
- purpose with or without fee is hereby granted.
-
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- PERFORMANCE OF THIS SOFTWARE.
- ***************************************************************************** */
-
- function __awaiter(thisArg, _arguments, P, generator) {
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
- return new (P || (P = Promise))(function (resolve, reject) {
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
- step((generator = generator.apply(thisArg, _arguments || [])).next());
- });
- }
-
- /*
- * base64-arraybuffer 1.0.1 <https:/niklasvh/base64-arraybuffer>
- * Copyright (c) 2021 Niklas von Hertzen <https://hertzen.com>
- * Released under MIT License
- */
- var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
- // Use a lookup table to find the index.
- var lookup = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256);
- for (var i = 0; i < chars.length; i++) {
- lookup[chars.charCodeAt(i)] = i;
- }
- var encode = function (arraybuffer) {
- var bytes = new Uint8Array(arraybuffer), i, len = bytes.length, base64 = '';
- for (i = 0; i < len; i += 3) {
- base64 += chars[bytes[i] >> 2];
- base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];
- base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];
- base64 += chars[bytes[i + 2] & 63];
- }
- if (len % 3 === 2) {
- base64 = base64.substring(0, base64.length - 1) + '=';
- }
- else if (len % 3 === 1) {
- base64 = base64.substring(0, base64.length - 2) + '==';
- }
- return base64;
- };
-
- const lastBlobMap = new Map();
- const transparentBlobMap = new Map();
- function getTransparentBlobFor(width, height, dataURLOptions) {
- return __awaiter(this, void 0, void 0, function* () {
- const id = `${width}-${height}`;
- if ('OffscreenCanvas' in globalThis) {
- if (transparentBlobMap.has(id))
- return transparentBlobMap.get(id);
- const offscreen = new OffscreenCanvas(width, height);
- offscreen.getContext('2d');
- const blob = yield offscreen.convertToBlob(dataURLOptions);
- const arrayBuffer = yield blob.arrayBuffer();
- const base64 = encode(arrayBuffer);
- transparentBlobMap.set(id, base64);
- return base64;
- }
- else {
- return '';
- }
- });
- }
- const worker = self;
- worker.onmessage = function (e) {
- return __awaiter(this, void 0, void 0, function* () {
- if ('OffscreenCanvas' in globalThis) {
- const { id, bitmap, width, height, dataURLOptions } = e.data;
- const transparentBase64 = getTransparentBlobFor(width, height, dataURLOptions);
- const offscreen = new OffscreenCanvas(width, height);
- const ctx = offscreen.getContext('2d');
- ctx.drawImage(bitmap, 0, 0);
- bitmap.close();
- const blob = yield offscreen.convertToBlob(dataURLOptions);
- const type = blob.type;
- const arrayBuffer = yield blob.arrayBuffer();
- const base64 = encode(arrayBuffer);
- if (!lastBlobMap.has(id) && (yield transparentBase64) === base64) {
- lastBlobMap.set(id, base64);
- return worker.postMessage({ id });
- }
- if (lastBlobMap.get(id) === base64)
- return worker.postMessage({ id });
- worker.postMessage({
- id,
- type,
- base64,
- width,
- height,
- });
- lastBlobMap.set(id, base64);
- }
- else {
- return worker.postMessage({ id: e.data.id });
- }
- });
- };
-
-})();
-}, null);

It looks like the migration to Vite means that the base64 worker is back. From the built rrweb.js file in the /node_modules you can see:

const encodedJs = "KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMD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i5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=";
const decodeBase64 = (base64) => Uint8Array.from(atob(base64), (c2) => c2.charCodeAt(0));
const blob = typeof window !== "undefined" && window.Blob && new Blob([decodeBase64(encodedJs)], { type: "text/javascript;charset=utf-8" });
function WorkerWrapper(options) {
  let objURL;
  try {
    objURL = blob && (window.URL || window.webkitURL).createObjectURL(blob);
    if (!objURL) throw "";
    const worker = new Worker(objURL, {
      name: options == null ? void 0 : options.name
    });
    worker.addEventListener("error", () => {
      (window.URL || window.webkitURL).revokeObjectURL(objURL);
    });
    return worker;
  } catch (e2) {
    return new Worker(
      "data:text/javascript;base64," + encodedJs,
      {
        name: options == null ? void 0 : options.name
      }
    );
  } finally {
    objURL && (window.URL || window.webkitURL).revokeObjectURL(objURL);
  }
}

This doesn't make total sense to me because the changes made in rrweb-io/rrweb#1309 have not been undone but I'm happy to proceed here and see if it's needed


All other patches have been replaced with comments inline

Copy link

vercel bot commented Jun 26, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
posthog-js ✅ Ready (Inspect) Visit Preview Oct 22, 2024 10:23am

Comment on lines 9 to 22
- 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);
+ }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaces

- const stylesheet = Array.from(doc.styleSheets).find((s) => {
- return s.href === n.href;
+ const href = n.href
+ let stylesheet = Array.from(doc.styleSheets).find((s) => {
+ return s.href === href;
});
+ if (!stylesheet && href.includes('.css')) {
+ const rootDomain = window.location.origin
+ const stylesheetPath = href.replace(window.location.href, '')
+ const potentialStylesheetHref = rootDomain + '/' + stylesheetPath
+ stylesheet = Array.from(doc.styleSheets).find((s) => {
+ return s.href === potentialStylesheetHref;
+ });
+ }

Copy link

github-actions bot commented Jun 26, 2024

Size Change: +68.6 kB (+2.43%)

Total Size: 2.89 MB

Filename Size Change
dist/all-external-dependencies.js 182 kB +9.79 kB (+5.7%) 🔍
dist/array.full.js 334 kB +9.79 kB (+3.02%)
dist/array.full.no-external.js 333 kB +9.79 kB (+3.03%)
dist/module.full.js 334 kB +9.81 kB (+3.02%)
dist/module.full.no-external.js 333 kB +9.81 kB (+3.03%)
dist/recorder-v2.js 102 kB +9.81 kB (+10.59%) ⚠️
dist/recorder.js 103 kB +9.81 kB (+10.58%) ⚠️
ℹ️ View Unchanged
Filename Size
dist/array.full.es5.js 248 kB
dist/array.js 155 kB
dist/array.no-external.js 154 kB
dist/exception-autocapture.js 8.75 kB
dist/external-scripts-loader.js 2.19 kB
dist/main.js 156 kB
dist/module.js 155 kB
dist/module.no-external.js 154 kB
dist/surveys-preview.js 56.7 kB
dist/surveys.js 62.1 kB
dist/tracing-headers.js 1.33 kB
dist/web-vitals.js 10.3 kB

compressed-size-action

Comment on lines 55 to 71
- 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,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaces

- const bitmap = yield 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,

Comment on lines +55 to +71
- 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 = await createImageBitmap(canvas, {
+ resizeWidth: width,
+ resizeHeight: height
+ });
worker.postMessage(
{
id,
bitmap,
- width: canvas.width,
- height: canvas.height,
+ width: width,
+ height: height,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaces

- const bitmap = yield 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,

Comment on lines +30 to +47
- 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);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaces:

- 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);

@marandaneto
Copy link
Member

Size Change: -268 kB (-25.73%) 🎉

Total Size: 775 kB

Filename Size Change
dist/array.full.js 157 kB -88.8 kB (-36.07%) 🎉
dist/recorder-v2.js 18.9 kB -89.8 kB (-82.63%) 🏆
dist/recorder.js 18.9 kB -89.8 kB (-82.63%) 🏆
ℹ️ View Unchanged
compressed-size-action

damn... i like it

@pauldambra
Copy link
Member

that's such a big change it makes you worry it's broken 🤣 🤣

@@ -10,7 +10,7 @@ app.get('/segment.html', function (req, res) {
})

app.get('/static/recorder.js', function (req, res) {
let filePath = path.join(__dirname, '/../../node_modules/rrweb/dist/rrweb.min.js')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't look like they have a min version of the js file anymore

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yuck!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, less mean-ly i wonder what our minified file looks like now 🤔

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 12kb bigger locally but doesn't look tooooo terrible

@@ -1,12 +1,6 @@
import { version } from 'rrweb/package.json'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was throwing

(!) Missing global variable names
https://rollupjs.org/configuration-options/#output-globals
Use "output.globals" to specify browser global variable names corresponding to external modules:
rrweb/package.json (guessing "package_json")
rrweb/package.json (guessing "package_json")

@daibhin
Copy link
Contributor Author

daibhin commented Jun 27, 2024

I believe the size gains were over reported... things in fact did not work

@pauldambra this might need another 👀 because I had do do some weird build fangling to get things working again

@daibhin daibhin requested a review from pauldambra June 27, 2024 12:48
@daibhin
Copy link
Contributor Author

daibhin commented Oct 14, 2024

Tested and confirmed that alpha.16 was running:

Screenshot 2024-10-14 at 18 23 20

Recordings seemed to work and specifically checked canvas elements
canvas

@pauldambra
Copy link
Member

tested this locally and got

Screenshot 2024-10-17 at 22 00 13

Copy link
Member

@pauldambra pauldambra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

marking as request changes just until we're sure this is working post es6 change

@daibhin
Copy link
Contributor Author

daibhin commented Oct 22, 2024

@pauldambra after many rounds of the Yalc dance I think I've managed to fix this (tldr patches are haard, one small mistake and the whole things blows up). Might be worth running it again so that you're happy with things.

Could ship today if everything looks good :)

Copy link
Member

@pauldambra pauldambra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works locally, that's definitive, ship it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bump patch Bump patch version when this PR gets merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants