From b9f5784de8edb95ce37fa72056f0dc95f9198555 Mon Sep 17 00:00:00 2001 From: Eoghan Murray Date: Wed, 28 May 2025 15:28:25 +0100 Subject: [PATCH 01/15] Don't allow video autoplay to automatically unfreeze page. If it's a 'real' playback, there should be a mount or a keyboard event which will serve to unfreeze the page. Also add other non-user events to the list (we really should have an `isUserEvent` function) --- packages/rrweb/src/record/index.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/rrweb/src/record/index.ts b/packages/rrweb/src/record/index.ts index 1308c378a6..70704e32c6 100644 --- a/packages/rrweb/src/record/index.ts +++ b/packages/rrweb/src/record/index.ts @@ -209,7 +209,15 @@ function record( e.type !== EventType.FullSnapshot && !( e.type === EventType.IncrementalSnapshot && - e.data.source === IncrementalSource.Mutation + [IncrementalSource.Mutation, + IncrementalSource.MediaInteraction, // often automatic e.g. background video loop + IncrementalSource.StyleSheetRule, + IncrementalSource.CanvasMutation, + IncrementalSource.Font, + IncrementalSource.Log, + IncrementalSource.StyleDeclaration, + IncrementalSource.AdoptedStyleSheet, + ].includes(e.data.source) ) ) { // we've got a user initiated event so first we need to apply From 68efa5bdda3efa41b0f9fa672867337f37345e0f Mon Sep 17 00:00:00 2001 From: eoghanmurray Date: Wed, 28 May 2025 14:36:41 +0000 Subject: [PATCH 02/15] Apply formatting changes --- packages/rrweb/src/record/index.ts | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/packages/rrweb/src/record/index.ts b/packages/rrweb/src/record/index.ts index 70704e32c6..e4f0f8a777 100644 --- a/packages/rrweb/src/record/index.ts +++ b/packages/rrweb/src/record/index.ts @@ -209,15 +209,16 @@ function record( e.type !== EventType.FullSnapshot && !( e.type === EventType.IncrementalSnapshot && - [IncrementalSource.Mutation, - IncrementalSource.MediaInteraction, // often automatic e.g. background video loop - IncrementalSource.StyleSheetRule, - IncrementalSource.CanvasMutation, - IncrementalSource.Font, - IncrementalSource.Log, - IncrementalSource.StyleDeclaration, - IncrementalSource.AdoptedStyleSheet, - ].includes(e.data.source) + [ + IncrementalSource.Mutation, + IncrementalSource.MediaInteraction, // often automatic e.g. background video loop + IncrementalSource.StyleSheetRule, + IncrementalSource.CanvasMutation, + IncrementalSource.Font, + IncrementalSource.Log, + IncrementalSource.StyleDeclaration, + IncrementalSource.AdoptedStyleSheet, + ].includes(e.data.source) ) ) { // we've got a user initiated event so first we need to apply From 396875d994da658a0f2024a7c1bef4aed9f71353 Mon Sep 17 00:00:00 2001 From: Eoghan Murray Date: Thu, 12 Jun 2025 15:02:45 +0100 Subject: [PATCH 03/15] Create a new `umd` folder alongside `dist` for output of UMD files with a plain `.js` instead of `.cjs` extension, as the latter won't be served with the correct mime type by jsdelivr - #1687 (just rename `.cjs` to `.js`) was rejected due to the the 'dual package hazard' [1], and produces a warning when run through publint.dev (which was the original motivation for changing to \.cjs) - jsdelivr won't be serving `.cjs` with the correct mime type: https://github.com/jsdelivr/jsdelivr/issues/18584 [1] https://nodejs.org/en/learn/modules/publishing-a-package#the-dual-package-hazard --- guide.md | 6 +++--- guide.zh_CN.md | 6 +++--- packages/rrweb-player/README.md | 2 +- vite.config.default.ts | 13 +++++++++---- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/guide.md b/guide.md index 764e359fb4..b713f76933 100644 --- a/guide.md +++ b/guide.md @@ -15,13 +15,13 @@ You are recommended to install rrweb via jsdelivr's CDN service: rel="stylesheet" href="https://cdn.jsdelivr.net/npm/rrweb@latest/dist/style.css" /> - + ``` Also, you can link to a specific version number that you can update manually: ```html - + ``` #### Only include the recorder code @@ -30,7 +30,7 @@ rrweb's code includes both the record and the replay parts. Most of the time you This also can be done by using the `@rrweb/record` package and the CDN service: ```html - + ``` #### Other packages diff --git a/guide.zh_CN.md b/guide.zh_CN.md index 4078cb2b6a..4b83eef469 100644 --- a/guide.zh_CN.md +++ b/guide.zh_CN.md @@ -13,13 +13,13 @@ rel="stylesheet" href="https://cdn.jsdelivr.net/npm/rrweb@latest/dist/style.css" /> - + ``` 也可以在 URL 中指定具体的版本号,例如: ```html - + ``` #### 仅引入录制部分 @@ -27,7 +27,7 @@ rrweb 代码分为录制和回放两部分,大多数时候用户在被录制的应用中只需要引入录制部分代码。同样可以通过使用 @rrweb/record 包和 CDN 服务来实现: ```html - + ``` #### 其他包 diff --git a/packages/rrweb-player/README.md b/packages/rrweb-player/README.md index 866adc7c67..855b559763 100644 --- a/packages/rrweb-player/README.md +++ b/packages/rrweb-player/README.md @@ -19,7 +19,7 @@ rrweb-player can also be included with ` + ``` Or installed by using NPM: diff --git a/vite.config.default.ts b/vite.config.default.ts index 46af9327a6..12764cfb9c 100644 --- a/vite.config.default.ts +++ b/vite.config.default.ts @@ -1,9 +1,9 @@ /// import dts from 'vite-plugin-dts'; -import { copyFileSync } from 'node:fs'; +import { copyFileSync, mkdirSync } from 'node:fs'; import { defineConfig, LibraryOptions, LibraryFormats, Plugin } from 'vite'; import { build, Format } from 'esbuild'; -import { resolve } from 'path'; +import { resolve, dirname } from 'path'; import { umdWrapper } from 'esbuild-plugin-umd-wrapper'; import * as fs from 'node:fs'; import { visualizer } from 'rollup-plugin-visualizer'; @@ -51,22 +51,27 @@ function minifyAndUMDPlugin({ outDir, }); } else { + mkdirSync(dirname(outputFilePath).replace('/dist', '/umd')); + const outUmd = `${outputFilePath}.umd.cjs`; await buildFile({ name, input: inputFilePath, - output: `${outputFilePath}.umd.cjs`, + output: outUmd, minify: false, isCss: false, outDir, }); + copyFileSync(outUmd, `${outputFilePath.replace('/dist/', '/umd/')}.js`); + const outUmdMin = `${outputFilePath}.umd.min.cjs`; await buildFile({ name, input: inputFilePath, - output: `${outputFilePath}.umd.min.cjs`, + output: outUmdMin, minify: true, isCss: false, outDir, }); + copyFileSync(outUmdMin, `${outputFilePath.replace('/dist/', '/umd/')}.min.js`); } } } From a3715c7f283a3f4d74b3aca374304da9c2317e1c Mon Sep 17 00:00:00 2001 From: Eoghan Murray Date: Thu, 12 Jun 2025 15:12:27 +0100 Subject: [PATCH 04/15] Update to point to alpha.19 as presumably that's when the umd folder will be available after the changes in this PR --- guide.md | 2 +- guide.zh_CN.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/guide.md b/guide.md index b713f76933..8ab8c17a7a 100644 --- a/guide.md +++ b/guide.md @@ -21,7 +21,7 @@ You are recommended to install rrweb via jsdelivr's CDN service: Also, you can link to a specific version number that you can update manually: ```html - + ``` #### Only include the recorder code diff --git a/guide.zh_CN.md b/guide.zh_CN.md index 4b83eef469..2bbeb4c9a5 100644 --- a/guide.zh_CN.md +++ b/guide.zh_CN.md @@ -19,7 +19,7 @@ 也可以在 URL 中指定具体的版本号,例如: ```html - + ``` #### 仅引入录制部分 From 6ca41fe2f7fef3b53ac72612caf45eab471a8183 Mon Sep 17 00:00:00 2001 From: eoghanmurray Date: Thu, 12 Jun 2025 14:18:49 +0000 Subject: [PATCH 05/15] Apply formatting changes --- vite.config.default.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/vite.config.default.ts b/vite.config.default.ts index 12764cfb9c..77d3d7d1cb 100644 --- a/vite.config.default.ts +++ b/vite.config.default.ts @@ -61,7 +61,10 @@ function minifyAndUMDPlugin({ isCss: false, outDir, }); - copyFileSync(outUmd, `${outputFilePath.replace('/dist/', '/umd/')}.js`); + copyFileSync( + outUmd, + `${outputFilePath.replace('/dist/', '/umd/')}.js`, + ); const outUmdMin = `${outputFilePath}.umd.min.cjs`; await buildFile({ name, @@ -71,7 +74,10 @@ function minifyAndUMDPlugin({ isCss: false, outDir, }); - copyFileSync(outUmdMin, `${outputFilePath.replace('/dist/', '/umd/')}.min.js`); + copyFileSync( + outUmdMin, + `${outputFilePath.replace('/dist/', '/umd/')}.min.js`, + ); } } } From b7e3c4ce850850d9ba2638fd210f76be8eeeb231 Mon Sep 17 00:00:00 2001 From: Eoghan Murray Date: Thu, 12 Jun 2025 15:36:45 +0100 Subject: [PATCH 06/15] Don't try to create the same directory twice (was failing on packages/packer/umd) --- vite.config.default.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/vite.config.default.ts b/vite.config.default.ts index 77d3d7d1cb..b6a4867d9d 100644 --- a/vite.config.default.ts +++ b/vite.config.default.ts @@ -1,6 +1,6 @@ /// import dts from 'vite-plugin-dts'; -import { copyFileSync, mkdirSync } from 'node:fs'; +import { copyFileSync, mkdirSync, existsSync } from 'node:fs'; import { defineConfig, LibraryOptions, LibraryFormats, Plugin } from 'vite'; import { build, Format } from 'esbuild'; import { resolve, dirname } from 'path'; @@ -51,7 +51,10 @@ function minifyAndUMDPlugin({ outDir, }); } else { - mkdirSync(dirname(outputFilePath).replace('/dist', '/umd')); + const umdDir = dirname(outputFilePath).replace('/dist', '/umd'); + if (!existsSync(umdDir)) { + mkdirSync(umdDir); + } const outUmd = `${outputFilePath}.umd.cjs`; await buildFile({ name, From 11d7b393cf7a51b336ab6d843fd7c1c3e9773ede Mon Sep 17 00:00:00 2001 From: Eoghan Murray Date: Thu, 12 Jun 2025 15:45:41 +0100 Subject: [PATCH 07/15] Create thirty-shirts-grow.md --- .changeset/thirty-shirts-grow.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .changeset/thirty-shirts-grow.md diff --git a/.changeset/thirty-shirts-grow.md b/.changeset/thirty-shirts-grow.md new file mode 100644 index 0000000000..9281088ee4 --- /dev/null +++ b/.changeset/thirty-shirts-grow.md @@ -0,0 +1,16 @@ +--- +"all": patch +"packer": patch +"plugins": patch +"record": patch +"replay": patch +"rrdom": patch +"rrdom-nodejs": patch +"rrweb": patch +"rrweb-player": patch +"rrweb-snapshot": patch +"types": patch +"utils": patch +--- + +Provide a /umd/ output folder alongside the /dist/ one so that we can serve UMD (Universal Module Definition) files with a .js extension, without upsetting expectations set by package.json that all .js files in /dist/ are modules From eb092d2343c6abdafc0b8879d3dbce19bfe3b26b Mon Sep 17 00:00:00 2001 From: Eoghan Murray Date: Fri, 5 Sep 2025 09:35:25 +0100 Subject: [PATCH 08/15] Revert something that shouldn't have gotten into the UMD branch folder --- packages/rrweb/src/record/index.ts | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/packages/rrweb/src/record/index.ts b/packages/rrweb/src/record/index.ts index e717e0e126..151be001cd 100644 --- a/packages/rrweb/src/record/index.ts +++ b/packages/rrweb/src/record/index.ts @@ -209,16 +209,7 @@ function record( e.type !== EventType.FullSnapshot && !( e.type === EventType.IncrementalSnapshot && - [ - IncrementalSource.Mutation, - IncrementalSource.MediaInteraction, // often automatic e.g. background video loop - IncrementalSource.StyleSheetRule, - IncrementalSource.CanvasMutation, - IncrementalSource.Font, - IncrementalSource.Log, - IncrementalSource.StyleDeclaration, - IncrementalSource.AdoptedStyleSheet, - ].includes(e.data.source) + e.data.source ===IncrementalSource.Mutation ) ) { // we've got a user initiated event so first we need to apply From 64996bf8b76708db8fd85b0fced4fe690e07d744 Mon Sep 17 00:00:00 2001 From: eoghanmurray Date: Fri, 5 Sep 2025 08:36:46 +0000 Subject: [PATCH 09/15] Apply formatting changes --- packages/rrweb/src/record/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/rrweb/src/record/index.ts b/packages/rrweb/src/record/index.ts index 151be001cd..65da8ec801 100644 --- a/packages/rrweb/src/record/index.ts +++ b/packages/rrweb/src/record/index.ts @@ -209,7 +209,7 @@ function record( e.type !== EventType.FullSnapshot && !( e.type === EventType.IncrementalSnapshot && - e.data.source ===IncrementalSource.Mutation + e.data.source === IncrementalSource.Mutation ) ) { // we've got a user initiated event so first we need to apply From 46898eb9063554aceed9684ed2288a8cd8d03b78 Mon Sep 17 00:00:00 2001 From: Justin Halsall Date: Fri, 5 Sep 2025 10:40:45 +0200 Subject: [PATCH 10/15] Update vite.config.default.ts --- vite.config.default.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vite.config.default.ts b/vite.config.default.ts index b6a4867d9d..c2b88f8732 100644 --- a/vite.config.default.ts +++ b/vite.config.default.ts @@ -64,6 +64,8 @@ function minifyAndUMDPlugin({ isCss: false, outDir, }); + // Workaround because jsdelivr does use correct mime types for .umd.cjs + // More info: https://github.com/jsdelivr/jsdelivr/issues/18584 https://github.com/rrweb-io/rrweb/pull/1704 copyFileSync( outUmd, `${outputFilePath.replace('/dist/', '/umd/')}.js`, From 469eb8c048cf4b6bf0f105b18809c34c06791511 Mon Sep 17 00:00:00 2001 From: Juice10 Date: Fri, 5 Sep 2025 08:41:44 +0000 Subject: [PATCH 11/15] Apply formatting changes --- vite.config.default.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vite.config.default.ts b/vite.config.default.ts index c2b88f8732..da4b1bb3b8 100644 --- a/vite.config.default.ts +++ b/vite.config.default.ts @@ -65,7 +65,7 @@ function minifyAndUMDPlugin({ outDir, }); // Workaround because jsdelivr does use correct mime types for .umd.cjs - // More info: https://github.com/jsdelivr/jsdelivr/issues/18584 https://github.com/rrweb-io/rrweb/pull/1704 + // More info: https://github.com/jsdelivr/jsdelivr/issues/18584 https://github.com/rrweb-io/rrweb/pull/1704 copyFileSync( outUmd, `${outputFilePath.replace('/dist/', '/umd/')}.js`, From 018447aa20d3688b604fbbfaef46f87f37dd948b Mon Sep 17 00:00:00 2001 From: Justin Halsall Date: Fri, 19 Sep 2025 15:33:53 +0200 Subject: [PATCH 12/15] build: include umd builds in published packages Add umd directory to the files array in package.json for all packages to include UMD builds in npm publications. Also update .gitignore to exclude umd folders from version control. --- .gitignore | 1 + packages/plugins/rrweb-plugin-canvas-webrtc-record/package.json | 1 + packages/plugins/rrweb-plugin-canvas-webrtc-replay/package.json | 1 + packages/plugins/rrweb-plugin-console-record/package.json | 1 + packages/plugins/rrweb-plugin-console-replay/package.json | 1 + packages/plugins/rrweb-plugin-sequential-id-record/package.json | 1 + packages/plugins/rrweb-plugin-sequential-id-replay/package.json | 1 + packages/record/package.json | 1 + packages/replay/package.json | 1 + packages/rrdom-nodejs/package.json | 1 + packages/rrdom/package.json | 1 + packages/rrweb-player/package.json | 1 + packages/rrweb-snapshot/package.json | 1 + packages/rrweb/package.json | 1 + packages/types/package.json | 1 + packages/utils/package.json | 1 + 16 files changed, 16 insertions(+) diff --git a/.gitignore b/.gitignore index 4266261313..f5fee78edc 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,7 @@ temp # output of `yarn build` build dist +umd # turbo cache .turbo diff --git a/packages/plugins/rrweb-plugin-canvas-webrtc-record/package.json b/packages/plugins/rrweb-plugin-canvas-webrtc-record/package.json index c5c0c38e29..b369e58b5d 100644 --- a/packages/plugins/rrweb-plugin-canvas-webrtc-record/package.json +++ b/packages/plugins/rrweb-plugin-canvas-webrtc-record/package.json @@ -20,6 +20,7 @@ } }, "files": [ + "umd", "dist", "package.json" ], diff --git a/packages/plugins/rrweb-plugin-canvas-webrtc-replay/package.json b/packages/plugins/rrweb-plugin-canvas-webrtc-replay/package.json index 901039cf78..b0fa9810ba 100644 --- a/packages/plugins/rrweb-plugin-canvas-webrtc-replay/package.json +++ b/packages/plugins/rrweb-plugin-canvas-webrtc-replay/package.json @@ -20,6 +20,7 @@ } }, "files": [ + "umd", "dist", "package.json" ], diff --git a/packages/plugins/rrweb-plugin-console-record/package.json b/packages/plugins/rrweb-plugin-console-record/package.json index 07897f39dd..db3b6013fa 100644 --- a/packages/plugins/rrweb-plugin-console-record/package.json +++ b/packages/plugins/rrweb-plugin-console-record/package.json @@ -20,6 +20,7 @@ } }, "files": [ + "umd", "dist", "package.json" ], diff --git a/packages/plugins/rrweb-plugin-console-replay/package.json b/packages/plugins/rrweb-plugin-console-replay/package.json index 2484fd7eb4..e9ef667087 100644 --- a/packages/plugins/rrweb-plugin-console-replay/package.json +++ b/packages/plugins/rrweb-plugin-console-replay/package.json @@ -20,6 +20,7 @@ } }, "files": [ + "umd", "dist", "package.json" ], diff --git a/packages/plugins/rrweb-plugin-sequential-id-record/package.json b/packages/plugins/rrweb-plugin-sequential-id-record/package.json index dc3fc37a15..c8e9ffae58 100644 --- a/packages/plugins/rrweb-plugin-sequential-id-record/package.json +++ b/packages/plugins/rrweb-plugin-sequential-id-record/package.json @@ -20,6 +20,7 @@ } }, "files": [ + "umd", "dist", "package.json" ], diff --git a/packages/plugins/rrweb-plugin-sequential-id-replay/package.json b/packages/plugins/rrweb-plugin-sequential-id-replay/package.json index 0538a6db52..4838040e83 100644 --- a/packages/plugins/rrweb-plugin-sequential-id-replay/package.json +++ b/packages/plugins/rrweb-plugin-sequential-id-replay/package.json @@ -20,6 +20,7 @@ } }, "files": [ + "umd", "dist", "package.json" ], diff --git a/packages/record/package.json b/packages/record/package.json index 6b1d244d6f..b7469bf8da 100644 --- a/packages/record/package.json +++ b/packages/record/package.json @@ -44,6 +44,7 @@ } }, "files": [ + "umd", "dist", "package.json" ], diff --git a/packages/replay/package.json b/packages/replay/package.json index 5c9d3f44e9..bdbb3786ce 100644 --- a/packages/replay/package.json +++ b/packages/replay/package.json @@ -45,6 +45,7 @@ "./dist/style.css": "./dist/style.css" }, "files": [ + "umd", "dist", "package.json" ], diff --git a/packages/rrdom-nodejs/package.json b/packages/rrdom-nodejs/package.json index 455c317a7c..0576b4da5a 100644 --- a/packages/rrdom-nodejs/package.json +++ b/packages/rrdom-nodejs/package.json @@ -33,6 +33,7 @@ } }, "files": [ + "umd", "dist", "package.json" ], diff --git a/packages/rrdom/package.json b/packages/rrdom/package.json index 9657f17209..a26ebeae52 100644 --- a/packages/rrdom/package.json +++ b/packages/rrdom/package.json @@ -21,6 +21,7 @@ } }, "files": [ + "umd", "dist", "package.json" ], diff --git a/packages/rrweb-player/package.json b/packages/rrweb-player/package.json index e9e7614bea..3dc5353863 100644 --- a/packages/rrweb-player/package.json +++ b/packages/rrweb-player/package.json @@ -51,6 +51,7 @@ "./dist/style.css": "./dist/style.css" }, "files": [ + "umd", "dist", "package.json" ], diff --git a/packages/rrweb-snapshot/package.json b/packages/rrweb-snapshot/package.json index 299384b2de..cd8bc7512f 100644 --- a/packages/rrweb-snapshot/package.json +++ b/packages/rrweb-snapshot/package.json @@ -44,6 +44,7 @@ } }, "files": [ + "umd", "dist", "package.json" ], diff --git a/packages/rrweb/package.json b/packages/rrweb/package.json index abb46b258e..e0ebe93f75 100644 --- a/packages/rrweb/package.json +++ b/packages/rrweb/package.json @@ -49,6 +49,7 @@ "./dist/style.css": "./dist/style.css" }, "files": [ + "umd", "dist", "package.json" ], diff --git a/packages/types/package.json b/packages/types/package.json index 8fce976d2e..c1c1676d85 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -42,6 +42,7 @@ } }, "files": [ + "umd", "dist", "package.json" ], diff --git a/packages/utils/package.json b/packages/utils/package.json index 10f0141da1..70521d1797 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -42,6 +42,7 @@ } }, "files": [ + "umd", "dist", "package.json" ], From 368521a4fd73b5a48461daa7a3d75769e77bcac8 Mon Sep 17 00:00:00 2001 From: Justin Halsall Date: Fri, 19 Sep 2025 15:42:07 +0200 Subject: [PATCH 13/15] Docs: point to correct file --- README.md | 2 +- README.zh_CN.md | 2 +- guide.md | 2 +- guide.zh_CN.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e73c2a8768..04ee58e8ce 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ [![Join the chat at slack](https://img.shields.io/badge/slack-@rrweb-teal.svg?logo=slack)](https://join.slack.com/t/rrweb/shared_invite/zt-siwoc6hx-uWay3s2wyG8t5GpZVb8rWg) [![Twitter Follow](https://img.shields.io/badge/twitter-@rrweb__io-teal.svg?logo=twitter)](https://twitter.com/rrweb_io) ![total gzip size](https://img.badgesize.io/https://cdn.jsdelivr.net/npm/rrweb@latest/dist/rrweb.min.cjs?compression=gzip&label=total%20gzip%20size) -![recorder gzip size](https://img.badgesize.io/https://cdn.jsdelivr.net/npm/rrweb@latest/dist/record/rrweb-record.min.cjs?compression=gzip&label=recorder%20gzip%20size) +![recorder gzip size](https://img.badgesize.io/https://cdn.jsdelivr.net/npm/@rrweb/record@latest/umd/record.min.js?compression=gzip&label=recorder%20gzip%20size) [![](https://data.jsdelivr.com/v1/package/npm/rrweb/badge)](https://www.jsdelivr.com/package/npm/rrweb) [中文文档](./README.zh_CN.md) diff --git a/README.zh_CN.md b/README.zh_CN.md index 6e6c408aa7..39623b16f2 100644 --- a/README.zh_CN.md +++ b/README.zh_CN.md @@ -11,7 +11,7 @@ [![Join the chat at slack](https://img.shields.io/badge/slack-@rrweb-teal.svg?logo=slack)](https://join.slack.com/t/rrweb/shared_invite/zt-siwoc6hx-uWay3s2wyG8t5GpZVb8rWg) ![total gzip size](https://img.badgesize.io/https://cdn.jsdelivr.net/npm/rrweb@latest/dist/rrweb.min.cjs?compression=gzip&label=total%20gzip%20size) -![recorder gzip size](https://img.badgesize.io/https://cdn.jsdelivr.net/npm/rrweb@latest/dist/record/rrweb-record.min.cjs?compression=gzip&label=recorder%20gzip%20size) +![recorder gzip size](https://img.badgesize.io/https://cdn.jsdelivr.net/npm/@rrweb/record@latest/umd/record.min.js?compression=gzip&label=recorder%20gzip%20size) [![](https://data.jsdelivr.com/v1/package/npm/rrweb/badge)](https://www.jsdelivr.com/package/npm/rrweb) > 我已开通 Github Sponsor, 您可以通过赞助的形式帮助 rrweb 的开发。 diff --git a/guide.md b/guide.md index 8ab8c17a7a..6bc95206d9 100644 --- a/guide.md +++ b/guide.md @@ -326,7 +326,7 @@ rrweb-player can also be included with ` + ``` Or installed by using NPM: diff --git a/guide.zh_CN.md b/guide.zh_CN.md index 2bbeb4c9a5..c60f18f50b 100644 --- a/guide.zh_CN.md +++ b/guide.zh_CN.md @@ -320,7 +320,7 @@ rrweb-player 同样可以使用 CDN 方式安装: rel="stylesheet" href="https://cdn.jsdelivr.net/npm/rrweb-player@latest/dist/style.css" /> - + ``` 或者通过 npm 安装: From 2d35929cc88360af0d97ec110f150e0b955dfc36 Mon Sep 17 00:00:00 2001 From: Justin Halsall Date: Fri, 19 Sep 2025 16:10:56 +0200 Subject: [PATCH 14/15] Docs: point to correct file --- packages/rrweb-player/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/rrweb-player/README.md b/packages/rrweb-player/README.md index 855b559763..15fcf4c88e 100644 --- a/packages/rrweb-player/README.md +++ b/packages/rrweb-player/README.md @@ -19,7 +19,7 @@ rrweb-player can also be included with ` + ``` Or installed by using NPM: From 2cbfa41003bedd9b6e715363603ad5b3da1b2f87 Mon Sep 17 00:00:00 2001 From: Justin Halsall Date: Sat, 20 Sep 2025 11:08:18 +0200 Subject: [PATCH 15/15] Remove unused code --- packages/rrweb/rollup.config.js | 261 -------------------------------- 1 file changed, 261 deletions(-) delete mode 100644 packages/rrweb/rollup.config.js diff --git a/packages/rrweb/rollup.config.js b/packages/rrweb/rollup.config.js deleted file mode 100644 index 998433bda9..0000000000 --- a/packages/rrweb/rollup.config.js +++ /dev/null @@ -1,261 +0,0 @@ -import typescript from 'rollup-plugin-typescript2'; -import esbuild from 'rollup-plugin-esbuild'; -import resolve from '@rollup/plugin-node-resolve'; -import postcss from 'rollup-plugin-postcss'; -import renameNodeModules from 'rollup-plugin-rename-node-modules'; -import webWorkerLoader from 'rollup-plugin-web-worker-loader'; -import pkg from './package.json'; - -function toRecordPath(path) { - return path - .replace(/^([\w]+)\//, '$1/record/') - .replace('rrweb', 'rrweb-record'); -} - -function toRecordPackPath(path) { - return path - .replace(/^([\w]+)\//, '$1/record/') - .replace('rrweb', 'rrweb-record-pack'); -} - -function toReplayPath(path) { - return path - .replace(/^([\w]+)\//, '$1/replay/') - .replace('rrweb', 'rrweb-replay'); -} - -function toReplayUnpackPath(path) { - return path - .replace(/^([\w]+)\//, '$1/replay/') - .replace('rrweb', 'rrweb-replay-unpack'); -} - -function toAllPath(path) { - return path.replace('rrweb', 'rrweb-all'); -} - -function toPluginPath(pluginName, stage) { - return (path) => - path - .replace(/^([\w]+)\//, '$1/plugins/') - .replace('rrweb', `${pluginName}-${stage}`); -} - -function toMinPath(path) { - return path.replace(/\.js$/, '.min.js'); -} - -const baseConfigs = [ - // all in one - { - input: './src/entries/all.ts', - name: 'rrweb', - pathFn: toAllPath, - esm: true, - }, - // record only - { - input: './src/record/index.ts', - name: 'rrwebRecord', - pathFn: toRecordPath, - }, - // record and pack - { - input: './src/entries/record-pack.ts', - name: 'rrwebRecord', - pathFn: toRecordPackPath, - }, - // replay only - { - input: './src/replay/index.ts', - name: 'rrwebReplay', - pathFn: toReplayPath, - }, - // replay and unpack - { - input: './src/entries/replay-unpack.ts', - name: 'rrwebReplay', - pathFn: toReplayUnpackPath, - }, - // record and replay - { - input: './src/index.ts', - name: 'rrweb', - pathFn: (p) => p, - }, - // plugins - { - input: './src/plugins/console/record/index.ts', - name: 'rrwebConsoleRecord', - pathFn: toPluginPath('console', 'record'), - }, - { - input: './src/plugins/canvas-webrtc/record/index.ts', - name: 'rrwebCanvasWebRTCRecord', - pathFn: toPluginPath('canvas-webrtc', 'record'), - }, - { - input: './src/plugins/canvas-webrtc/replay/index.ts', - name: 'rrwebCanvasWebRTCReplay', - pathFn: toPluginPath('canvas-webrtc', 'replay'), - }, - { - input: './src/plugins/console/replay/index.ts', - name: 'rrwebConsoleReplay', - pathFn: toPluginPath('console', 'replay'), - }, - { - input: './src/plugins/sequential-id/record/index.ts', - name: 'rrwebSequentialIdRecord', - pathFn: toPluginPath('sequential-id', 'record'), - }, - { - input: './src/plugins/sequential-id/replay/index.ts', - name: 'rrwebSequentialIdReplay', - pathFn: toPluginPath('sequential-id', 'replay'), - }, -]; - -let configs = []; - -function getPlugins(options = {}) { - const { minify = false, sourceMap = false } = options; - return [ - resolve({ browser: true }), - webWorkerLoader({ - targetPlatform: 'browser', - inline: true, - preserveSource: true, - sourceMap, - }), - esbuild({ - minify, - }), - postcss({ - extract: true, - inject: false, - minimize: minify, - sourceMap, - }), - ]; -} - -for (const c of baseConfigs) { - const basePlugins = [ - resolve({ browser: true }), - - // supports bundling `web-worker:..filename` - webWorkerLoader({ - targetPlatform: 'browser', - inline: true, - preserveSource: true, - }), - - typescript(), - ]; - const plugins = basePlugins.concat( - postcss({ - extract: false, - inject: false, - }), - ); - // browser - configs.push({ - input: c.input, - plugins: getPlugins(), - output: [ - { - name: c.name, - format: 'iife', - file: c.pathFn(pkg.unpkg), - }, - ], - }); - // browser + minify - configs.push({ - input: c.input, - plugins: getPlugins({ minify: true, sourceMap: true }), - output: [ - { - name: c.name, - format: 'iife', - file: toMinPath(c.pathFn(pkg.unpkg)), - sourcemap: true, - }, - ], - }); - // CommonJS - configs.push({ - input: c.input, - plugins, - output: [ - { - format: 'cjs', - file: c.pathFn('lib/rrweb.cjs'), - }, - ], - }); - if (c.esm) { - // ES module - configs.push({ - input: c.input, - plugins, - preserveModules: true, - output: [ - { - format: 'esm', - dir: 'es/rrweb', - plugins: [renameNodeModules('ext')], - }, - ], - }); - } -} - -if (process.env.BROWSER_ONLY) { - const browserOnlyBaseConfigs = [ - { - input: './src/index.ts', - name: 'rrweb', - pathFn: (p) => p, - }, - { - input: './src/entries/all.ts', - name: 'rrweb', - pathFn: toAllPath, - }, - { - input: './src/plugins/console/record/index.ts', - name: 'rrwebConsoleRecord', - pathFn: toPluginPath('console', 'record'), - }, - { - input: './src/plugins/canvas-webrtc/record/index.ts', - name: 'rrwebCanvasWebRTCRecord', - pathFn: toPluginPath('canvas-webrtc', 'record'), - }, - { - input: './src/plugins/canvas-webrtc/replay/index.ts', - name: 'rrwebCanvasWebRTCReplay', - pathFn: toPluginPath('canvas-webrtc', 'replay'), - }, - ]; - - configs = []; - - for (const c of browserOnlyBaseConfigs) { - configs.push({ - input: c.input, - plugins: getPlugins(), - output: [ - { - name: c.name, - format: 'iife', - file: c.pathFn(pkg.unpkg), - }, - ], - }); - } -} - -export default configs;