From efa0d2be1de192665741ef45e9f68f8135ffa594 Mon Sep 17 00:00:00 2001 From: David Newell Date: Tue, 22 Oct 2024 14:49:35 +0100 Subject: [PATCH] chore: upgrade rrweb to alpha.16 (#1276) --- package.json | 9 +- patches/rrweb@2.0.0-alpha.13.patch | 284 ----------------------------- patches/rrweb@2.0.0-alpha.16.patch | 98 ++++++++++ playground/segment/server.js | 2 +- pnpm-lock.yaml | 154 ++++++++++------ src/entrypoints/recorder.ts | 11 +- 6 files changed, 206 insertions(+), 352 deletions(-) delete mode 100644 patches/rrweb@2.0.0-alpha.13.patch create mode 100644 patches/rrweb@2.0.0-alpha.16.patch diff --git a/package.json b/package.json index 95ce2ffdd..35b6d1ca2 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "@rollup/plugin-node-resolve": "^15.3.0", "@rollup/plugin-terser": "^0.4.4", "@rollup/plugin-typescript": "^12.1.1", - "@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.5.0", @@ -103,8 +103,9 @@ "rollup": "^4.24.0", "rollup-plugin-dts": "^6.1.1", "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/rrweb-plugin-console-record": "2.0.0-alpha.15", + "rrweb-snapshot": "2.0.0-alpha.16", "sinon": "9.0.2", "testcafe": "1.19.0", "testcafe-browser-provider-browserstack": "1.14.0", @@ -126,7 +127,7 @@ ], "pnpm": { "patchedDependencies": { - "rrweb@2.0.0-alpha.13": "patches/rrweb@2.0.0-alpha.13.patch" + "rrweb@2.0.0-alpha.16": "patches/rrweb@2.0.0-alpha.16.patch" } } } diff --git a/patches/rrweb@2.0.0-alpha.13.patch b/patches/rrweb@2.0.0-alpha.13.patch deleted file mode 100644 index 63e3444ed..000000000 --- a/patches/rrweb@2.0.0-alpha.13.patch +++ /dev/null @@ -1,284 +0,0 @@ -diff --git a/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js b/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js -new file mode 100644 -index 0000000000000000000000000000000000000000..f7775474506e5f4a11539c9ad8fb75c0d2568de4 ---- /dev/null -+++ 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 -- * Copyright (c) 2021 Niklas von Hertzen -- * 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); -+var WorkerFactory = createBase64WorkerFactory('Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICAgJ3VzZSBzdHJpY3QnOwoKICAgIC8qISAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KICAgIENvcHlyaWdodCAoYykgTWljcm9zb2Z0IENvcnBvcmF0aW9uLg0KDQogICAgUGVybWlzc2lvbiB0byB1c2UsIGNvcHksIG1vZGlmeSwgYW5kL29yIGRpc3RyaWJ1dGUgdGhpcyBzb2Z0d2FyZSBmb3IgYW55DQogICAgcHVycG9zZSB3aXRoIG9yIHdpdGhvdXQgZmVlIGlzIGhlcmVieSBncmFudGVkLg0KDQogICAgVEhFIFNPRlRXQVJFIElTIFBST1ZJREVEICJBUyBJUyIgQU5EIFRIRSBBVVRIT1IgRElTQ0xBSU1TIEFMTCBXQVJSQU5USUVTIFdJVEgNCiAgICBSRUdBUkQgVE8gVEhJUyBTT0ZUV0FSRSBJTkNMVURJTkcgQUxMIElNUExJRUQgV0FSUkFOVElFUyBPRiBNRVJDSEFOVEFCSUxJVFkNCiAgICBBTkQgRklUTkVTUy4gSU4gTk8gRVZFTlQgU0hBTEwgVEhFIEFVVEhPUiBCRSBMSUFCTEUgR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AgICAgICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7DQogICAgICAgICAgICAgICAgd29ya2VyLnBvc3RNZXNzYWdlKHsNCiAgICAgICAgICAgICAgICAgICAgaWQsDQogICAgICAgICAgICAgICAgICAgIHR5cGUsDQogICAgICAgICAgICAgICAgICAgIGJhc2U2NCwNCiAgICAgICAgICAgICAgICAgICAgd2lkdGgsDQogICAgICAgICAgICAgICAgICAgIGhlaWdodCwNCiAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7DQogICAgICAgICAgICB9DQogICAgICAgICAgICBlbHNlIHsNCiAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgfSk7DQogICAgfTsKCn0pKCk7Cgo=', null, false); - /* eslint-enable */ - - export { WorkerFactory as default }; -diff --git a/es/rrweb/packages/rrweb/src/record/mutation.js b/es/rrweb/packages/rrweb/src/record/mutation.js -index 30ea08b22210dde2f6e27c1adf83e0164a47554f..11334f600856e1ed7dcbdea28e8c2dc38a6b6742 100644 ---- a/es/rrweb/packages/rrweb/src/record/mutation.js -+++ b/es/rrweb/packages/rrweb/src/record/mutation.js -@@ -386,7 +386,7 @@ class MutationBuffer { - (m.oldValue || '').toLowerCase() === 'password') { - target.setAttribute('data-rr-is-password', 'true'); - } -- if (!ignoreAttribute(target.tagName, attributeName)) { -+ if (!ignoreAttribute(target.tagName, attributeName, value)) { - item.attributes[attributeName] = transformAttribute(this.doc, toLowerCase(target.tagName), toLowerCase(attributeName), value); - if (attributeName === 'style') { - if (!this.unattachedDoc) { -diff --git a/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas-manager.js b/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas-manager.js -index da2c103fe6b1408a5996f0eb3bf047571e434cc2..f5b060c7e0728a3e2c6cf62b01d97282f2484ac3 100644 ---- a/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas-manager.js -+++ b/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas-manager.js -@@ -91,11 +91,21 @@ 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) => { -@@ -120,12 +130,22 @@ class CanvasManager { - context.clear(context.COLOR_BUFFER_BIT); - } - } -- 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, - dataURLOptions: options.dataURLOptions, - }, [bitmap]); - })); -diff --git a/es/rrweb/packages/rrweb-snapshot/es/rrweb-snapshot.js b/es/rrweb/packages/rrweb-snapshot/es/rrweb-snapshot.js -index 0fc7d4bcafc9be822347f9437658478fd77d9972..b5a59feb930d0582488f64f8509deb668ff3de56 100644 ---- a/es/rrweb/packages/rrweb-snapshot/es/rrweb-snapshot.js -+++ b/es/rrweb/packages/rrweb-snapshot/es/rrweb-snapshot.js -@@ -48,7 +48,7 @@ function stringifyStylesheet(s) { - try { - const rules = s.rules || s.cssRules; - return rules -- ? fixBrowserCompatibilityIssuesInCSS(Array.from(rules, stringifyRule).join('')) -+ ? fixBrowserCompatibilityIssuesInCSS(Array.from(rules).map(stringifyRule).join('')) - : null; - } - catch (error) { -@@ -385,8 +385,9 @@ function transformAttribute(doc, tagName, name, value) { - } - return value; - } --function ignoreAttribute(tagName, name, _value) { -- return (tagName === 'video' || tagName === 'audio') && name === 'autoplay'; -+function ignoreAttribute(tagName, name, value) { -+ return (((tagName === 'video' || tagName === 'audio') && name === 'autoplay') || -+ (tagName === 'video' && name === 'src' && value && value.startsWith('blob:http'))); - } - function _isBlockedElement(element, blockClass, blockSelector) { - try { -@@ -641,9 +642,18 @@ function serializeElementNode(n, options) { - } - } - if (tagName === 'link' && inlineStylesheet) { -- 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; -+ }); -+ } - let cssText = null; - if (stylesheet) { - cssText = stringifyStylesheet(stylesheet); diff --git a/patches/rrweb@2.0.0-alpha.16.patch b/patches/rrweb@2.0.0-alpha.16.patch new file mode 100644 index 000000000..5a76bf4d6 --- /dev/null +++ b/patches/rrweb@2.0.0-alpha.16.patch @@ -0,0 +1,98 @@ +diff --git a/dist/rrweb.js b/dist/rrweb.js +index 1db2d08b2fe9a73521001c3aa88b1a64d1b3e71a..5a3ea8410b0f1dfa7248b9cb9752c04eea7b3ad3 100644 +--- a/dist/rrweb.js ++++ b/dist/rrweb.js +@@ -85,6 +85,9 @@ function isCSSImportRule(rule) { + function isCSSStyleRule(rule) { + return "selectorText" in rule; + } ++function findStylesheet(doc, href) { ++ return Array.from(doc.styleSheets).find((s) => s.href === href); ++} + class Mirror { + constructor() { + __publicField$1(this, "idNodeMap", /* @__PURE__ */ new Map()); +@@ -661,9 +664,14 @@ function serializeElementNode(n2, options) { + } + } + if (tagName === "link" && inlineStylesheet) { +- const stylesheet = Array.from(doc.styleSheets).find((s2) => { +- return s2.href === n2.href; +- }); ++ const href = n2.href; ++ let stylesheet = findStylesheet(doc, href); ++ if (!stylesheet && href.includes('.css')) { ++ const rootDomain = window.location.origin ++ const stylesheetPath = href.replace(window.location.href, '') ++ const potentialStylesheetHref = rootDomain + '/' + stylesheetPath ++ stylesheet = findStylesheet(doc, 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 = await createImageBitmap(canvas, { ++ resizeWidth: width, ++ resizeHeight: height ++ }); + worker.postMessage( + { + id, + bitmap, +- width: canvas.width, +- height: canvas.height, ++ width: width, ++ height: height, + dataURLOptions: options.dataURLOptions + }, + [bitmap] +@@ -9805,6 +9828,7 @@ class Replayer { + } + const { addCustomEvent } = record; + const { freezePage } = record; ++const version = "2.0.0-alpha.16" + export { + EventType, + IncrementalSource, +@@ -9816,6 +9840,7 @@ export { + freezePage, + _mirror as mirror, + record, +- utils ++ utils, ++ version, + }; + //# sourceMappingURL=rrweb.js.map diff --git a/playground/segment/server.js b/playground/segment/server.js index ba671bca9..8c67259a1 100644 --- a/playground/segment/server.js +++ b/playground/segment/server.js @@ -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') + let filePath = path.join(__dirname, '/../../node_modules/rrweb/dist/rrweb.js') res.sendFile(filePath) }) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3200f66c5..bdee9346f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5,9 +5,9 @@ settings: excludeLinksFromLockfile: false patchedDependencies: - rrweb@2.0.0-alpha.13: - hash: es276qklpcauxli22h726xp7fe - path: patches/rrweb@2.0.0-alpha.13.patch + rrweb@2.0.0-alpha.16: + hash: x52pllmg6k5suqkcoa7bdybazq + path: patches/rrweb@2.0.0-alpha.16.patch dependencies: core-js: @@ -66,9 +66,12 @@ devDependencies: '@rollup/plugin-typescript': specifier: ^12.1.1 version: 12.1.1(rollup@4.24.0)(tslib@2.5.0)(typescript@5.5.4) + '@rrweb/rrweb-plugin-console-record': + specifier: 2.0.0-alpha.15 + version: 2.0.0-alpha.15(rrweb@2.0.0-alpha.16) '@rrweb/types': - specifier: 2.0.0-alpha.13 - version: 2.0.0-alpha.13 + specifier: 2.0.0-alpha.16 + version: 2.0.0-alpha.16 '@sentry/types': specifier: 8.7.0 version: 8.7.0 @@ -202,17 +205,17 @@ devDependencies: specifier: ^5.12.0 version: 5.12.0(rollup@4.24.0) rrweb: - specifier: 2.0.0-alpha.13 - version: 2.0.0-alpha.13(patch_hash=es276qklpcauxli22h726xp7fe) + specifier: 2.0.0-alpha.16 + version: 2.0.0-alpha.16(patch_hash=x52pllmg6k5suqkcoa7bdybazq) rrweb-snapshot: - specifier: 2.0.0-alpha.13 - version: 2.0.0-alpha.13 + specifier: 2.0.0-alpha.16 + version: 2.0.0-alpha.16 sinon: specifier: 9.0.2 version: 9.0.2 testcafe: specifier: 1.19.0 - version: 1.19.0(fp-ts@2.16.9) + version: 1.19.0(fp-ts@2.16.2) testcafe-browser-provider-browserstack: specifier: 1.14.0 version: 1.14.0 @@ -2586,7 +2589,7 @@ packages: estree-walker: 2.0.2 fdir: 6.4.2(picomatch@4.0.2) is-reference: 1.2.1 - magic-string: 0.30.12 + magic-string: 0.30.5 picomatch: 4.0.2 rollup: 4.24.0 dev: true @@ -2799,10 +2802,18 @@ packages: dev: true optional: true - /@rrweb/types@2.0.0-alpha.13: - resolution: {integrity: sha512-ytq+MeVm/vP2ybw+gTAN3Xvt7HN2yS+wlbfnwHpQMftxrwzq0kEZHdw+Jp5WUvvpONWzXriNAUU9dW0qLGkzNg==} + /@rrweb/rrweb-plugin-console-record@2.0.0-alpha.15(rrweb@2.0.0-alpha.16): + resolution: {integrity: sha512-66iOkD99AS8WqQNAnDtkJsQnSD8E+tZx3tWMJltpRDovXs4GoBE9eYxQeTWSigz6iaqbrxYPIqQIRck+zqnheg==} + peerDependencies: + rrweb: ^2.0.0-alpha.15 + dependencies: + rrweb: 2.0.0-alpha.16(patch_hash=x52pllmg6k5suqkcoa7bdybazq) + dev: true + + /@rrweb/types@2.0.0-alpha.16: + resolution: {integrity: sha512-E6cACNVsm+NUhn7dzocQoKyXI7BHrHRRm5Ab23yrAzEQ2caWocCEYJhqDlc4KRVJBkQfXZfyWm8+2d0uggFuZg==} dependencies: - rrweb-snapshot: 2.0.0-alpha.13 + rrweb-snapshot: 2.0.0-alpha.16 dev: true /@sentry/types@8.7.0: @@ -3991,7 +4002,7 @@ packages: engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} hasBin: true dependencies: - caniuse-lite: 1.0.30001669 + caniuse-lite: 1.0.30001580 electron-to-chromium: 1.4.418 node-releases: 2.0.12 update-browserslist-db: 1.0.11(browserslist@4.21.7) @@ -4103,8 +4114,8 @@ packages: engines: {node: '>=10'} dev: true - /caniuse-lite@1.0.30001669: - resolution: {integrity: sha512-DlWzFDJqstqtIVx1zeSpIMLjunf5SmwOw0N2Ck/QSQdS8PLS4+9HrLaYei4w8BIAL7IB/UEDu889d8vhCTPA0w==} + /caniuse-lite@1.0.30001580: + resolution: {integrity: sha512-mtj5ur2FFPZcCEpXFy8ADXbDACuNFXg6mxVDqp7tqooX6l3zwm+d8EPoeOSIFRDvHs8qu7/SLFOGniULkcH2iA==} dev: true /capture-exit@2.0.0: @@ -5073,7 +5084,7 @@ packages: '@tsconfig/node14': 1.0.3 ast-metadata-inferer: 0.8.0 browserslist: 4.21.7 - caniuse-lite: 1.0.30001669 + caniuse-lite: 1.0.30001580 eslint: 8.57.0 find-up: 5.0.0 lodash.memoize: 4.1.2 @@ -5578,6 +5589,7 @@ packages: /fflate@0.4.8: resolution: {integrity: sha512-FJqqoDBR00Mdj9ppamLa/Y7vxm+PRmNWA67N846RvsoYVMKB4q3y/de5PA7gUmRMYK/8CMz2GDZQmCRN1wBcWA==} + dev: false /figures@3.2.0: resolution: {integrity: sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==} @@ -5722,8 +5734,8 @@ packages: engines: {node: '>= 0.6'} dev: true - /fp-ts@2.16.9: - resolution: {integrity: sha512-+I2+FnVB+tVaxcYyQkHUq7ZdKScaBlX53A41mxQtpIccsfyv8PzdzP7fzp2AY832T4aoK6UZ5WRX/ebGd8uZuQ==} + /fp-ts@2.16.2: + resolution: {integrity: sha512-CkqAjnIKFqvo3sCyoBTqgJvF+bHrSik584S9nhTjtBESLx26cbtVMR/T9a6ApChOcSDAaM3JydDmWDUn4EEXng==} dev: true /fragment-cache@0.2.1: @@ -6317,7 +6329,7 @@ packages: side-channel: 1.0.4 dev: true - /io-ts-types@0.5.16(fp-ts@2.16.9)(io-ts@2.2.16)(monocle-ts@2.3.13)(newtype-ts@0.3.5): + /io-ts-types@0.5.16(fp-ts@2.16.2)(io-ts@2.2.16)(monocle-ts@2.3.13)(newtype-ts@0.3.5): resolution: {integrity: sha512-h9noYVfY9rlbmKI902SJdnV/06jgiT2chxG6lYDxaYNp88HscPi+SBCtmcU+m0E7WT5QSwt7sIMj93+qu0FEwQ==} peerDependencies: fp-ts: ^2.0.0 @@ -6325,18 +6337,18 @@ packages: monocle-ts: ^2.0.0 newtype-ts: ^0.3.2 dependencies: - fp-ts: 2.16.9 - io-ts: 2.2.16(fp-ts@2.16.9) - monocle-ts: 2.3.13(fp-ts@2.16.9) - newtype-ts: 0.3.5(fp-ts@2.16.9)(monocle-ts@2.3.13) + fp-ts: 2.16.2 + io-ts: 2.2.16(fp-ts@2.16.2) + monocle-ts: 2.3.13(fp-ts@2.16.2) + newtype-ts: 0.3.5(fp-ts@2.16.2)(monocle-ts@2.3.13) dev: true - /io-ts@2.2.16(fp-ts@2.16.9): + /io-ts@2.2.16(fp-ts@2.16.2): resolution: {integrity: sha512-y5TTSa6VP6le0hhmIyN0dqEXkrZeJLeC5KApJq6VLci3UEKF80lZ+KuoUs02RhBxNWlrqSNxzfI7otLX1Euv8Q==} peerDependencies: fp-ts: ^2.5.0 dependencies: - fp-ts: 2.16.9 + fp-ts: 2.16.2 dev: true /ip@1.1.5: @@ -6655,7 +6667,7 @@ packages: /is-reference@1.2.1: resolution: {integrity: sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==} dependencies: - '@types/estree': 1.0.6 + '@types/estree': 1.0.5 dev: true /is-regex@1.1.4: @@ -7947,6 +7959,13 @@ packages: '@jridgewell/sourcemap-codec': 1.5.0 dev: true + /magic-string@0.30.5: + resolution: {integrity: sha512-7xlpfBaQaP/T6Vh8MO/EqXSW5En6INHEvEXQiuff7Gku0PWjU3uf6w/j9o7O+SpB5fOAkrI5HeoNgwjEO0pFsA==} + engines: {node: '>=12'} + dependencies: + '@jridgewell/sourcemap-codec': 1.4.15 + dev: true + /make-dir@3.1.0: resolution: {integrity: sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==} engines: {node: '>=8'} @@ -8132,12 +8151,12 @@ packages: resolution: {integrity: sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==} dev: true - /monocle-ts@2.3.13(fp-ts@2.16.9): + /monocle-ts@2.3.13(fp-ts@2.16.2): resolution: {integrity: sha512-D5Ygd3oulEoAm3KuGO0eeJIrhFf1jlQIoEVV2DYsZUMz42j4tGxgct97Aq68+F8w4w4geEnwFa8HayTS/7lpKQ==} peerDependencies: fp-ts: ^2.5.0 dependencies: - fp-ts: 2.16.9 + fp-ts: 2.16.2 dev: true /ms@2.0.0: @@ -8204,6 +8223,12 @@ packages: hasBin: true dev: true + /nanoid@3.3.7: + resolution: {integrity: sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==} + engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} + hasBin: true + dev: true + /nanomatch@1.2.13: resolution: {integrity: sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==} engines: {node: '>=0.10.0'} @@ -8232,14 +8257,14 @@ packages: engines: {node: '>= 0.6'} dev: true - /newtype-ts@0.3.5(fp-ts@2.16.9)(monocle-ts@2.3.13): + /newtype-ts@0.3.5(fp-ts@2.16.2)(monocle-ts@2.3.13): resolution: {integrity: sha512-v83UEQMlVR75yf1OUdoSFssjitxzjZlqBAjiGQ4WJaML8Jdc68LJ+BaSAXUmKY4bNzp7hygkKLYTsDi14PxI2g==} peerDependencies: fp-ts: ^2.0.0 monocle-ts: ^2.0.0 dependencies: - fp-ts: 2.16.9 - monocle-ts: 2.3.13(fp-ts@2.16.9) + fp-ts: 2.16.2 + monocle-ts: 2.3.13(fp-ts@2.16.2) dev: true /nice-try@1.0.5: @@ -8700,15 +8725,9 @@ packages: resolution: {integrity: sha512-CzFr90qM24ju5f88quFC/6qohjC144rehe5n6DH900lgXmUe86+xCKc10ev56gRKC4/BkHUoG4uSiQgBiIXwDA==} dev: true - /picocolors@1.0.0: - resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==} - dev: true - /picocolors@1.1.0: resolution: {integrity: sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==} - requiresBuild: true dev: true - optional: true /picomatch@2.3.1: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} @@ -8796,6 +8815,15 @@ packages: engines: {node: '>=0.10.0'} dev: true + /postcss@8.4.47: + resolution: {integrity: sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ==} + engines: {node: ^10 || ^12 || >=14} + dependencies: + nanoid: 3.3.7 + picocolors: 1.1.0 + source-map-js: 1.2.1 + dev: true + /preact-render-to-string@6.3.1(preact@10.19.3): resolution: {integrity: sha512-NQ28WrjLtWY6lKDlTxnFpKHZdpjfF+oE6V4tZ0rTrunHrtZp6Dm0oFrcJalt/5PNeqJz4j1DuZDS0Y6rCBoqDA==} peerDependencies: @@ -9368,27 +9396,32 @@ packages: fsevents: 2.3.3 dev: true - /rrdom@2.0.0-alpha.13: - resolution: {integrity: sha512-GJD3L2MPbIg3+VgCwwfujB4HRXyMfDdg8o3djPjSB9rMX2b52Hx2tBUmwmdnWfgWKtYGDJ2wVX9Dng3tZEBHVA==} + /rrdom@2.0.0-alpha.17: + resolution: {integrity: sha512-b6caDiNcFO96Opp7TGdcVd4OLGSXu5dJe+A0IDiAu8mk7OmhqZCSDlgQdTKmdO5wMf4zPsUTgb8H/aNvR3kDHA==} dependencies: - rrweb-snapshot: 2.0.0-alpha.13 + rrweb-snapshot: 2.0.0-alpha.17 + dev: true + + /rrweb-snapshot@2.0.0-alpha.16: + resolution: {integrity: sha512-p81OrzUiCmUMZzJu4fGHeLB00PIbVIqsV/zhqzr2pitHTUXpMYcyOvDWt0vHdla0vnowEPaHq3Wsu6cUc732/w==} dev: true - /rrweb-snapshot@2.0.0-alpha.13: - resolution: {integrity: sha512-slbhNBCYjxLGCeH95a67ECCy5a22nloXp1F5wF7DCzUNw80FN7tF9Lef1sRGLNo32g3mNqTc2sWLATlKejMxYw==} + /rrweb-snapshot@2.0.0-alpha.17: + resolution: {integrity: sha512-GBg5pV8LHOTbeVmH2VHLEFR0mc2QpQMzAvcoxEGfPNWgWHc8UvKCyq7pqN1vA+fDZ+yXXbixeO0kB2pzVvFCBw==} + dependencies: + postcss: 8.4.47 dev: true - /rrweb@2.0.0-alpha.13(patch_hash=es276qklpcauxli22h726xp7fe): - resolution: {integrity: sha512-a8GXOCnzWHNaVZPa7hsrLZtNZ3CGjiL+YrkpLo0TfmxGLhjNZbWY2r7pE06p+FcjFNlgUVTmFrSJbK3kO7yxvw==} + /rrweb@2.0.0-alpha.16(patch_hash=x52pllmg6k5suqkcoa7bdybazq): + resolution: {integrity: sha512-Uxl7quZc8gm9RqrUR+10prZBoAfKWvM5lqlWDe7zd2wAkMiBQawDHUrmt8dByx96aiLonvm4oLsbBK14A0A0Tg==} dependencies: - '@rrweb/types': 2.0.0-alpha.13 + '@rrweb/types': 2.0.0-alpha.16 '@types/css-font-loading-module': 0.0.7 '@xstate/fsm': 1.5.2 base64-arraybuffer: 1.0.2 - fflate: 0.4.8 mitt: 3.0.0 - rrdom: 2.0.0-alpha.13 - rrweb-snapshot: 2.0.0-alpha.13 + rrdom: 2.0.0-alpha.17 + rrweb-snapshot: 2.0.0-alpha.16 dev: true patched: true @@ -9689,6 +9722,11 @@ packages: - supports-color dev: true + /source-map-js@1.2.1: + resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==} + engines: {node: '>=0.10.0'} + dev: true + /source-map-resolve@0.5.3: resolution: {integrity: sha512-Htz+RnsXWk5+P2slx5Jh3Q66vhQj1Cllm0zvnaY98+NFx+Dv2CF/f5O/t8x+KaNdrdIAsruNzoh/KpialbqAnw==} deprecated: See https://github.com/lydell/source-map-resolve#deprecated @@ -10104,16 +10142,16 @@ packages: - supports-color dev: true - /testcafe-reporter-dashboard@1.0.0-rc.1(fp-ts@2.16.9): + /testcafe-reporter-dashboard@1.0.0-rc.1(fp-ts@2.16.2): resolution: {integrity: sha512-VWFVo8kmG3OICD1RFdjvDCsEltGcHqTYN9X0aDyXg+0PqioYuAGUKQxqRA31dnG+2/RnaET4VJhhEvcbKzwhTw==} dependencies: es6-promise: 4.2.8 - io-ts: 2.2.16(fp-ts@2.16.9) - io-ts-types: 0.5.16(fp-ts@2.16.9)(io-ts@2.2.16)(monocle-ts@2.3.13)(newtype-ts@0.3.5) + io-ts: 2.2.16(fp-ts@2.16.2) + io-ts-types: 0.5.16(fp-ts@2.16.2)(io-ts@2.2.16)(monocle-ts@2.3.13)(newtype-ts@0.3.5) isomorphic-fetch: 3.0.0 jsonwebtoken: 8.5.1 - monocle-ts: 2.3.13(fp-ts@2.16.9) - newtype-ts: 0.3.5(fp-ts@2.16.9)(monocle-ts@2.3.13) + monocle-ts: 2.3.13(fp-ts@2.16.2) + newtype-ts: 0.3.5(fp-ts@2.16.2)(monocle-ts@2.3.13) semver: 5.7.1 uuid: 3.3.3 transitivePeerDependencies: @@ -10146,7 +10184,7 @@ packages: resolution: {integrity: sha512-6km7D26+KCQGeFlSQ9fVEU7tD8qdioSpqzxU8CCZkd2KzBS0jTFkqaJ54rPaLdd5+wdhgO3+as3LMm4F0EDeYA==} dev: true - /testcafe@1.19.0(fp-ts@2.16.9): + /testcafe@1.19.0(fp-ts@2.16.2): resolution: {integrity: sha512-HH6Z60N51SPw7WcNFhvbrcV1a6Dri1T0npFmE8BvxQEjsYog2whtdxj01yfaYrE87AZK/ep6lOwrqy0P6WmsfQ==} engines: {node: '>=14.0.0'} hasBin: true @@ -10231,7 +10269,7 @@ packages: testcafe-browser-tools: 2.0.23 testcafe-hammerhead: 24.5.19 testcafe-legacy-api: 5.1.4 - testcafe-reporter-dashboard: 1.0.0-rc.1(fp-ts@2.16.9) + testcafe-reporter-dashboard: 1.0.0-rc.1(fp-ts@2.16.2) testcafe-reporter-json: 2.2.0 testcafe-reporter-list: 2.1.0 testcafe-reporter-minimal: 2.1.0 @@ -10633,7 +10671,7 @@ packages: dependencies: browserslist: 4.21.7 escalade: 3.1.1 - picocolors: 1.0.0 + picocolors: 1.1.0 dev: true /uri-js@4.2.2: diff --git a/src/entrypoints/recorder.ts b/src/entrypoints/recorder.ts index 55af68c47..514cfb45f 100644 --- a/src/entrypoints/recorder.ts +++ b/src/entrypoints/recorder.ts @@ -1,5 +1,6 @@ -import { version } from 'rrweb/package.json' -import { getRecordConsolePlugin, record } from 'rrweb' +// @ts-expect-error - Patched to include the version +import { record as rrwebRecord, version } from 'rrweb' +import { getRecordConsolePlugin } from '@rrweb/rrweb-plugin-console-record' // rrweb/network@1 code starts // most of what is below here will be removed when rrweb release their code for this @@ -669,15 +670,15 @@ export const getRecordNetworkPlugin: (options?: NetworkRecordOptions) => RecordP assignableWindow.__PosthogExtensions__ = assignableWindow.__PosthogExtensions__ || {} assignableWindow.__PosthogExtensions__.rrwebPlugins = { getRecordConsolePlugin, getRecordNetworkPlugin } -assignableWindow.__PosthogExtensions__.rrweb = { record: record, version: 'v2', rrwebVersion: version } +assignableWindow.__PosthogExtensions__.rrweb = { record: rrwebRecord, version: 'v2', rrwebVersion: version } // we used to put all of these items directly on window, and now we put it on __PosthogExtensions__ // but that means that old clients which lazily load this extension are looking in the wrong place // yuck, // so we also put them directly on the window // when 1.161.1 is the oldest version seen in production we can remove this -assignableWindow.rrweb = { record: record, version: 'v2', rrwebVersion: version } +assignableWindow.rrweb = { record: rrwebRecord, version: 'v2', rrwebVersion: version } assignableWindow.rrwebConsoleRecord = { getRecordConsolePlugin } assignableWindow.getRecordNetworkPlugin = getRecordNetworkPlugin -export default record +export default rrwebRecord