Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
16 changes: 15 additions & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,19 @@
"baseBranch": "main",
"updateInternalDependencies": "patch",
"bumpVersionsWithWorkspaceProtocolOnly": true,
"ignore": []
"ignore": [
Copy link
Member

Choose a reason for hiding this comment

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

Why not use changesets for it?

Copy link
Member

Choose a reason for hiding this comment

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

I don't think the release workflow will work well if we're not using changesets :thinking_face:

Copy link
Member Author

Choose a reason for hiding this comment

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

ah! so, we don't need (i don't think) to release all these packages because we don't use them

we only ever import these in posthog for replay and for that we're using the main rrweb package.

so, we should get a subset of the total number of rrweb packages released and then be able to import those in the main posthog app

(i'm assuming this won't work the way i expect and will need a few tries to get right)

(TL;DR rrweb publishes tonnes of packages but we don't need to release them all i believe)

"@posthog/rrweb-utils",
"@posthog/rrdom",
"@posthog/rrdom-nodejs",
"@posthog/rrweb-snapshot",
"@posthog/rrweb-record",
"@posthog/rrweb-replay",
"@posthog/rrweb-packer",
"@posthog/rrweb-all",
"@posthog/rrweb-plugin-console-replay",
"@posthog/rrweb-plugin-sequential-id-record",
"@posthog/rrweb-plugin-sequential-id-replay",
"@posthog/rrweb-plugin-canvas-webrtc-record",
"@posthog/rrweb-plugin-canvas-webrtc-replay"
]
}
39 changes: 39 additions & 0 deletions .github/workflows/library-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,46 @@
build: true
- run: pnpm test:functional

rrweb:
name: rrweb tests
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup environment
uses: ./.github/actions/setup
with:
build: false

- name: Check if rrweb packages changed
id: changed
run: |
CHANGED=$(git diff --name-only origin/main...HEAD | grep -c '^packages/rrweb/' || true)
echo "rrweb-changed=$([[ $CHANGED -gt 0 ]] && echo true || echo false)" >> $GITHUB_OUTPUT

- name: Build rrweb packages
if: steps.changed.outputs.rrweb-changed == 'true'
run: pnpm turbo run build --filter='./packages/rrweb/**' --concurrency=1

- name: Install Chrome for Puppeteer
if: steps.changed.outputs.rrweb-changed == 'true'
run: pnpm --filter @posthog/rrweb exec puppeteer browsers install chrome

- name: Run rrweb tests
if: steps.changed.outputs.rrweb-changed == 'true'
run: xvfb-run --server-args="-screen 0 1920x1080x24" pnpm turbo run test --filter='./packages/rrweb/**'

- name: Upload diff images on failure
uses: actions/upload-artifact@v4
if: failure() && steps.changed.outputs.rrweb-changed == 'true'
with:
name: rrweb-image-diff
path: packages/rrweb/**/__image_snapshots__/__diff_output__/*.png
if-no-files-found: ignore

lint:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
name: Lint
runs-on: ubuntu-22.04
steps:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ jobs:
- name: '@posthog/rollup-plugin'
- name: '@posthog/types'
- name: '@posthog/webpack-plugin'
- name: '@posthog/rrweb'
- name: '@posthog/rrweb-types'
- name: '@posthog/rrweb-plugin-console-record'

steps:
- name: Checkout repository
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ test-result.json
yarn-error.log
stats.html
bundle-stats*.html

# vite temp files
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
.eslintcache
cypress/downloads/downloads.html
/test-results/
Expand Down
6 changes: 3 additions & 3 deletions packages/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@
"@jest/globals": "^29.7.0",
"@playwright/test": "^1.52.0",
"@posthog-tooling/rollup-utils": "workspace:*",
"@posthog/rrweb-plugin-console-record": "^0.0.34",
"@posthog/rrweb-record": "^0.0.34",
"@posthog/rrweb-types": "^0.0.34",
"@posthog/rrweb-plugin-console-record": "workspace:*",
"@posthog/rrweb-record": "workspace:*",
"@posthog/rrweb-types": "workspace:*",
Comment on lines +70 to +72
Copy link
Member

Choose a reason for hiding this comment

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

This probably deserves a patch bump?

"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-commonjs": "^28.0.6",
"@rollup/plugin-json": "^6.1.0",
Expand Down
46 changes: 46 additions & 0 deletions packages/rrweb/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
module.exports = {
root: true,
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
env: {
browser: true,
es2020: true,
node: true,
},
rules: {
// Disable prettier - rrweb formatting is normalized separately
'prettier/prettier': 'off',
// Disable rules that conflict with rrweb's codebase
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-this-alias': 'off',
'@typescript-eslint/no-unused-expressions': 'off',
'@typescript-eslint/no-require-imports': 'off',
'no-prototype-builtins': 'off',
'no-useless-escape': 'off',
'no-empty': 'off',
'prefer-const': 'off',
'no-constant-condition': 'off',
'no-extra-semi': 'off',
'no-var': 'off',
'no-global-assign': 'off',
// posthog-js specific rules that don't apply to rrweb
'posthog-js/no-direct-array-check': 'off',
'posthog-js/no-direct-boolean-check': 'off',
'posthog-js/no-direct-document-check': 'off',
'posthog-js/no-direct-function-check': 'off',
'posthog-js/no-direct-navigator-check': 'off',
'posthog-js/no-direct-null-check': 'off',
'posthog-js/no-direct-number-check': 'off',
'posthog-js/no-direct-object-check': 'off',
'posthog-js/no-direct-string-check': 'off',
'posthog-js/no-direct-undefined-check': 'off',
'posthog-js/no-direct-window-check': 'off',
'compat/compat': 'off',
},
ignorePatterns: ['dist/', 'node_modules/', '*.js', '*.cjs', '*.mjs'],
}
42 changes: 42 additions & 0 deletions packages/rrweb/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# PostHog's copy of RRWeb

this is open because we believe in open source,
and we want to be able to contribute back to upstream rrweb and refer back to this when we do

# but please don't use it yourself

all changes will be only focussed on posthog and we won't make any effort to support anybody else using this

if you say "i started using this, you changed it, and now my thing broke"
we will say "we told you not to use it"

The upstream rrweb is here https://github.com/rrweb-io/rrweb

## Is it an exact fork?

No, there are packages we don't need such as the svelte player and rr-video
So, we deleted them...

## Hello internal PostHog folk

We build this and publish it to NPM so that we can use it in posthog-js

If you want to contribute a change back to upstream rrweb
then you need to open a person fork and contribute from there
Comment on lines +20 to +25
Copy link
Member

Choose a reason for hiding this comment

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

Maybe explain why do we need to do this versus just using the upstream? mention they're slow to take upstreams, etc, etc. etc.


### How to use it...

1. `pnpm install` to, erm, install
2. `pnpm build:all` to get a stable base built
3. `pnpm dev` to get auto building of changed things while making changes
4. `pnpm test` to run the tests
5. `pnpm test:update` to update snapshots if necessary

# FAQ

- does this mean you're planning on stopping using RRWEB?
- no
- can I use this repo?
- unless you are contributing changes for posthog, no
- should I sponsor rrweb?
- absolutely, yes. we do, you should too, it's great
4 changes: 4 additions & 0 deletions packages/rrweb/all/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.turbo
dist
node_modules
yarn-error.log
38 changes: 38 additions & 0 deletions packages/rrweb/all/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# @rrweb/all

## 2.0.0-alpha.18

### Patch Changes

- [#1593](https://github.com/rrweb-io/rrweb/pull/1593) [`5a78938`](https://github.com/rrweb-io/rrweb/commit/5a789385a341311ba327a768fe0e2f0f2f5002ee) Thanks [@daibhin](https://github.com/daibhin)! - `NodeType` enum was moved from rrweb-snapshot to @rrweb/types
The following types where moved from rrweb-snapshot to @rrweb/types: `documentNode`, `documentTypeNode`, `legacyAttributes`, `textNode`, `cdataNode`, `commentNode`, `elementNode`, `serializedNode`, `serializedNodeWithId`, `serializedElementNodeWithId`, `serializedTextNodeWithId`, `IMirror`, `INode`, `mediaAttributes`, `attributes` and `DataURLOptions`
- Updated dependencies [[`04ee6ed`](https://github.com/rrweb-io/rrweb/commit/04ee6eda57157f0e04f18f907d8f3e59ababc753), [`5fbb904`](https://github.com/rrweb-io/rrweb/commit/5fbb904edb653f3da17e6775ee438d81ef0bba83), [`5a78938`](https://github.com/rrweb-io/rrweb/commit/5a789385a341311ba327a768fe0e2f0f2f5002ee), [`53b83bb`](https://github.com/rrweb-io/rrweb/commit/53b83bb037f9cb30c93179548f436ed776f143ab)]:
- [email protected]
- @rrweb/[email protected]
- @rrweb/[email protected]

## 2.0.0-alpha.17

### Patch Changes

- [`db20184`](https://github.com/rrweb-io/rrweb/commit/db201841accd2b5df3cd7c88779aa62ab158501c) Thanks [@Juice10](https://github.com/Juice10)! - Keep package version in sync with other packages

- Updated dependencies [[`db20184`](https://github.com/rrweb-io/rrweb/commit/db201841accd2b5df3cd7c88779aa62ab158501c), [`40bbc25`](https://github.com/rrweb-io/rrweb/commit/40bbc25fc287badc317a53f2d3f21b1c9f2b211b), [`68076b7`](https://github.com/rrweb-io/rrweb/commit/68076b724ff19d198d4f351a05063b85e1705a8c), [`8059d96`](https://github.com/rrweb-io/rrweb/commit/8059d9695146626b102b2059a3a9b932d5f598f6), [`335639a`](https://github.com/rrweb-io/rrweb/commit/335639af9b0ce7f70eb0f38ce113d877c7325158), [`be6bf52`](https://github.com/rrweb-io/rrweb/commit/be6bf52c248c35de1b3491e3a3440ff61f876414)]:
- @rrweb/[email protected]
- [email protected]
- @rrweb/[email protected]

## 2.0.0-alpha.15

### Major Changes

- [#1497](https://github.com/rrweb-io/rrweb/pull/1497) [`2606a2a`](https://github.com/rrweb-io/rrweb/commit/2606a2a28f2a6d897b8ae4ea3ec40ef0eeacbfaf) Thanks [@Juice10](https://github.com/Juice10)! - Distributed files have new filenames, paths and extensions. **Important: If you reference distributed files or types directly, you might have to update your paths/filenames. E.g. you import from `rrweb/typings/...` or `rrdom/es`. However you run `import rrweb from '@posthog/rrweb'` you won't notice a difference with this change.** If you include rrweb files directly in a script tag, you might have to update that path to include a the `.umd.cjs` files instead. All `.js` files now use ES modules which can be used in modern browsers, node.js and bundlers that support ES modules. All npm packages now also ship `.cjs` and `.umd.cjs` files. The `.umd.cjs` files are CommonJS modules that bundle all files together to make it easy to ship one file to browser environments (similar to the previous `.js` files). The `.cjs` files are CommonJS modules that can be used in older Node.js environments. Types should be better defined in `package.json` and if you need specific types they might be exported from new packages (for example `PlayerMachineState` and `SpeedMachineState` are now exported from `@rrweb/replay`). Check the `package.json`'s `main` and `exports` field for the available files.

- [#1497](https://github.com/rrweb-io/rrweb/pull/1497) [`2606a2a`](https://github.com/rrweb-io/rrweb/commit/2606a2a28f2a6d897b8ae4ea3ec40ef0eeacbfaf) Thanks [@Juice10](https://github.com/Juice10)! - Remove the rrweb-all.js, rrweb-record.js, and rrweb-replay.js files from `rrweb` package. Now you can use `@rrweb/all`, `@rrweb/record`, and `@rrweb/replay` packages instead. Check out the README of each package for more information or check out [PR #1033](https://github.com/rrweb-io/rrweb/pull/1033) to see the changes.

### Patch Changes

- Updated dependencies [[`7261c43`](https://github.com/rrweb-io/rrweb/commit/7261c43f60973e88325edf832e4d0e057fbff0ae), [`4014305`](https://github.com/rrweb-io/rrweb/commit/40143059446cee5c042c007b1c2e976f36e172f5), [`609b7fa`](https://github.com/rrweb-io/rrweb/commit/609b7fac79a552f746dc880a28927dee382cd082), [`82f6fec`](https://github.com/rrweb-io/rrweb/commit/82f6fecf36413ecbc994a510144487f1de20d1d5), [`2606a2a`](https://github.com/rrweb-io/rrweb/commit/2606a2a28f2a6d897b8ae4ea3ec40ef0eeacbfaf), [`2606a2a`](https://github.com/rrweb-io/rrweb/commit/2606a2a28f2a6d897b8ae4ea3ec40ef0eeacbfaf), [`5c27b76`](https://github.com/rrweb-io/rrweb/commit/5c27b763192bda9dd91806f95df7c1cd0ab083a6), [`d38893f`](https://github.com/rrweb-io/rrweb/commit/d38893f6338facf331fd1f6e63c121120b81177d), [`d7cf8dd`](https://github.com/rrweb-io/rrweb/commit/d7cf8dd07547f6fb22ef82e341a88357c4053bd3), [`2606a2a`](https://github.com/rrweb-io/rrweb/commit/2606a2a28f2a6d897b8ae4ea3ec40ef0eeacbfaf), [`e08706a`](https://github.com/rrweb-io/rrweb/commit/e08706ae60268b6eb05c6292ef948c71bd423ce3)]:
- [email protected]
- @rrweb/[email protected]
- @rrweb/[email protected]
Loading
Loading