Commit Graph

7 Commits

Author SHA1 Message Date
Eoghan Murray
33e01f5f00 Umd folder (#1704)
* 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)

* Apply formatting changes

* 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

* Update to point to alpha.19 as presumably that's when the umd folder will be available after the changes in this PR

* Apply formatting changes

* Don't try to create the same directory twice (was failing on packages/packer/umd)

* Create thirty-shirts-grow.md

* Revert something that shouldn't have gotten into the UMD branch folder

* Apply formatting changes

* Update vite.config.default.ts

* Apply formatting changes

* 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.

* Docs: point to correct file

* Remove unused code

* docs: update rrweb cdn urls to umd bundles

Align README and guide examples with published UMD file locations for
rrweb, @rrweb/record, and @rrweb/replay.

Update versioned rrweb script examples from 2.0.0-alpha.19 to
2.0.0-alpha.21 in both English and Chinese guides.

* build(all): include umd folder in package files

---------

Co-authored-by: eoghanmurray <eoghanmurray@users.noreply.github.com>
Co-authored-by: Justin Halsall <Juice10@users.noreply.github.com>
2026-02-13 15:03:23 +01:00
Justin Halsall
22bc4c334e Migrates to vite@6 to drop base64 inlined worker source from all bundles (#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>
2026-02-06 15:11:36 +01:00
github-actions[bot]
77e208076b Version Packages (alpha) (#1780)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-02-03 14:20:05 +01:00
github-actions[bot]
c059dbf41d Version Packages (alpha) (#1605)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-11-21 00:50:38 +01:00
github-actions[bot]
1db7a99ff3 Version Packages (alpha) (#1554)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-12-06 15:05:09 +01:00
github-actions[bot]
8837fe39aa Version Packages (alpha) (#1526)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-08-02 13:30:46 +02:00
Justin Halsall
be6bf52c24 Reverse monkey patch built in methods to support LWC (#1509)
* Get around monkey patched Nodes

* inlineImages: Setting of `image.crossOrigin` is not always necessary (#1468)

Setting of the `crossorigin` attribute is not necessary for same-origin images, and causes an immediate image reload (albeit from cache) necessitating the use of a load event listener which subsequently mutates the snapshot.  This change allows us to  avoid the mutation of the snapshot for the same-origin case.

* Modify inlineImages test to remove delay and show that we can inline images without mutation

* Add an explicit test for when the `image.crossOrigin = 'anonymous';` method is necessary.  Uses a combination of about:blank and our test server to simulate a cross-origin context

* Other test changes: there were some spurious rrweb mutations being generated by the addition of the crossorigin attribute that are now elimnated from the rrweb/__snapshots__/integration.test.ts.snap after this PR - this is good

* Move `childNodes` to @rrweb/utils

* Use non-monkey patched versions of the `childNodes`, `parentNode` `parentElement` `textContent` accessors

* Add getRootNode and contains, and add comprehensive todo list

* chore: Update turbo.json tasks for better build process

* Update caniuse-lite

* chore: Update eslint-plugin-compat to version 5.0.0

* chore: Bump @rrweb/utils version to 2.0.0-alpha.15

* delete unused yarn.lock files

* Set correct @rrweb/utils version in package.json

* Migrate over some accessors to reverse-monkey-patched version

* Add missing functions

* Fix illegal invocation error

* Revert closer to what it was.

This feels incorrect to me (Justin Halsall), but some of the tests break without it so I'm restoring this to be closer to its original here:
cfd686d488/packages/rrweb-snapshot/src/snapshot.ts (L1011)

* Reverse monkey patch all methods LWC hijacks

* Make tests more stable

* Safely handle rrdom nodes in hasShadowRoot

* Remove duplicated test

* Use variable `serverURL` in test

* Use monorepo default browserlist

* Fix typing issue for new typescript

* Remove unused package

* Remove unused code

* Add prefix to reverse-monkey-patched methods to make them more explicit

* Add default exports to @rrweb/utils

---------

Co-authored-by: Eoghan Murray <eoghan@getthere.ie>
2024-08-02 10:55:05 +02:00