Skip to content

Commit 22bc4c3

Browse files
Juice10ruicontiCopiloteoghanmurray
authored
Migrates to vite@6 to drop base64 inlined worker source from all bundles (rrweb-io#1762)
* chore: maintain CSS output file name in vite@6.0.1 Without this change, build would fail because the produced stylesheet assumes the `package.json['name']` i.e., `styles/rrweb.css`. To maintain the existing behavior, these changes are required. See https://vite.dev/guide/migration.html#customize-css-output-file-name-in-library-mode * build(rrvideo): upgrade playwright from 1.32.1 to 1.56.1 Update playwright dependency to latest version and refactor test execution options to use a shared configuration with increased timeout for stability. * debug(rrvideo): add comprehensive logging to video transformation process Add detailed console.log statements throughout the transformToVideo function to track execution flow and debug potential issues. Logging covers browser launch, context creation, page navigation, replay progress, and video file operations. * ci(rrvideo): install playwright browsers and improve test output visibility - Add Playwright Chromium installation step to CI workflow - Change test execution stdio from 'pipe' to 'inherit' for better debugging * fix(rrvideo): prevent autoplay and manually start playback after event listeners Set autoPlay to false in replayer configuration and manually call play() after all event listeners are attached. This ensures event handlers are properly registered before playback begins, preventing potential race conditions. Also refactor test execution options to separate stdio configuration from timeout settings for better control over test output visibility. * fix(rrvideo): add timeout and error handling to replay process Add comprehensive error handling to prevent hanging during video transformation: - Add 2-minute timeout for replay finish event - Add console and error listeners for better debugging - Improve promise chain with proper error catching - Clear timeout on successful completion or error This prevents the process from hanging indefinitely when the replay finish event never fires. * fix(rrvideo): add error handling and restructure replayer initialization Wrap replayer initialization in try-catch block to handle potential errors gracefully. Restructure Player instantiation to use rrwebPlayer directly instead of rrwebPlayer.Player, and move width/height into props object for correct API usage. On error, log to console and trigger onReplayFinish callback to prevent hanging state. * build(umd): rename record and replay globals Update UMD build globals for recorder and replayer and refresh documentation accordingly. BREAKING CHANGE: UMD global names changed to rrwebRecord and rrwebReplay. * fix(rrvideo): adjust replay timeout to duration * docs: update rrweb-player CDN script path * Update vite.config.default.ts Co-authored-by: Eoghan Murray <eoghan@getthere.ie> --------- Co-authored-by: Rui <rui@conti.sh> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Eoghan Murray <eoghan@getthere.ie>
1 parent ad5ac17 commit 22bc4c3

File tree

32 files changed

+441
-181
lines changed

32 files changed

+441
-181
lines changed

.changeset/brave-walls-shine.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@rrweb/record": major
3+
"@rrweb/replay": major
4+
---
5+
6+
BREAKING CHANGE: Rename UMD global names from `rrweb` to `rrwebRecord` for the recorder and `rrwebReplay` for the replayer. This avoids conflicts when both are loaded on the same page.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
"@rrweb/all": patch
3+
"@rrweb/packer": patch
4+
"@rrweb/record": patch
5+
"rrweb-snapshot": patch
6+
"rrweb": patch
7+
"@rrweb/web-extension": patch
8+
---
9+
10+
Drop base64 inlined worker source from all bundles

.changeset/tender-foxes-rest.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"rrvideo": patch
3+
---
4+
5+
Adjust replay timeout to be based on video duration plus a 2-minute buffer instead of a fixed 2-minute timeout. This prevents timeout errors for longer recordings.

.changeset/twenty-flies-attend.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"rrvideo": patch
3+
---
4+
5+
Add better logging on playback and fix the use of rrweb-player so it doesn't stall and fail playback

.github/workflows/ci-cd.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ jobs:
3131
- name: Build Project
3232
run: NODE_OPTIONS='--max-old-space-size=4096' yarn build:all
3333

34+
- name: Install Playwright browsers
35+
run: cd packages/rrvideo && yarn playwright install chromium
36+
3437
- name: Check types
3538
run: yarn check-types
3639

guide.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,20 @@ This also can be done by using the `@rrweb/record` package and the CDN service:
3333
<script src="https://cdn.jsdelivr.net/npm/@rrweb/record@latest/dist/record.umd.min.cjs"></script>
3434
```
3535

36+
The recorder UMD build exposes a global named `rrwebRecord`.
37+
38+
#### Only include the replayer code
39+
40+
```html
41+
<link
42+
rel="stylesheet"
43+
href="https://cdn.jsdelivr.net/npm/@rrweb/replay@latest/dist/style.css"
44+
/>
45+
<script src="https://cdn.jsdelivr.net/npm/@rrweb/replay@latest/dist/replay.umd.min.cjs"></script>
46+
```
47+
48+
The replayer UMD build exposes a global named `rrwebReplay`.
49+
3650
#### Other packages
3751

3852
Besides the `rrweb` and `@rrweb/record` packages, rrweb also provides other packages for different usage.
@@ -326,7 +340,7 @@ rrweb-player can also be included with `<script>`:
326340
rel="stylesheet"
327341
href="https://cdn.jsdelivr.net/npm/rrweb-player@latest/dist/style.css"
328342
/>
329-
<script src="https://cdn.jsdelivr.net/npm/rrweb-player@latest/dist/index.js"></script>
343+
<script src="https://cdn.jsdelivr.net/npm/rrweb-player@latest/dist/rrweb-player.umd.cjs"></script>
330344
```
331345

332346
Or installed by using NPM:

guide.zh_CN.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,20 @@ rrweb 代码分为录制和回放两部分,大多数时候用户在被录制
3030
<script src="https://cdn.jsdelivr.net/npm/@rrweb/record@latest/dist/record.umd.min.cjs"></script>
3131
```
3232

33+
录制端的 UMD build 会暴露全局变量 `rrwebRecord`
34+
35+
#### 仅引入回放部分
36+
37+
```html
38+
<link
39+
rel="stylesheet"
40+
href="https://cdn.jsdelivr.net/npm/@rrweb/replay@latest/dist/style.css"
41+
/>
42+
<script src="https://cdn.jsdelivr.net/npm/@rrweb/replay@latest/dist/replay.umd.min.cjs"></script>
43+
```
44+
45+
回放端的 UMD build 会暴露全局变量 `rrwebReplay`
46+
3347
#### 其他包
3448

3549
除了 `rrweb``@rrweb/record` 包之外,rrweb 还提供了其他不同用途的包。
@@ -320,7 +334,7 @@ rrweb-player 同样可以使用 CDN 方式安装:
320334
rel="stylesheet"
321335
href="https://cdn.jsdelivr.net/npm/rrweb-player@latest/dist/style.css"
322336
/>
323-
<script src="https://cdn.jsdelivr.net/npm/rrweb-player@latest/dist/index.js"></script>
337+
<script src="https://cdn.jsdelivr.net/npm/rrweb-player@latest/dist/rrweb-player.umd.cjs"></script>
324338
```
325339

326340
或者通过 npm 安装:

packages/all/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
],
5151
"devDependencies": {
5252
"puppeteer": "^20.9.0",
53-
"vite": "^5.3.1",
53+
"vite": "^6.0.1",
5454
"vite-plugin-dts": "^3.9.1",
5555
"vitest": "^1.4.0",
5656
"typescript": "^5.4.5"

packages/packer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
"package.json"
7272
],
7373
"devDependencies": {
74-
"vite": "^5.3.1",
74+
"vite": "^6.0.1",
7575
"vite-plugin-dts": "^3.9.1",
7676
"vitest": "^1.4.0",
7777
"typescript": "^5.4.5"

packages/plugins/rrweb-plugin-canvas-webrtc-record/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"devDependencies": {
4646
"rrweb": "^2.0.0-alpha.20",
4747
"typescript": "^5.4.5",
48-
"vite": "^5.3.1",
48+
"vite": "^6.0.1",
4949
"vite-plugin-dts": "^3.9.1"
5050
},
5151
"peerDependencies": {

0 commit comments

Comments
 (0)