Skip to content

[codex] Split rrweb-snapshot utility implementations#1839

Open
Juice10 wants to merge 7 commits into
mainfrom
codex/split-snapshot-rebuild-utils
Open

[codex] Split rrweb-snapshot utility implementations#1839
Juice10 wants to merge 7 commits into
mainfrom
codex/split-snapshot-rebuild-utils

Conversation

@Juice10

@Juice10 Juice10 commented May 19, 2026

Copy link
Copy Markdown
Member

Summary

  • move shared rrweb-snapshot helpers into shared-utils.ts
  • move snapshot-only helper implementations into snapshot-utils.ts
  • move rebuild-only node metadata comparison into rebuild-utils.ts
  • keep utils.ts as an explicit public compatibility shim

Validation

  • yarn workspace rrweb-snapshot check-types
  • yarn workspace @rrweb/record build
  • yarn workspace @rrweb/record test
  • rg -n "postcss" packages/record/dist --glob '*.{js,cjs}' found no matches\n- yarn workspace rrweb-snapshot lint (warnings only, no errors)

@changeset-bot

changeset-bot Bot commented May 19, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: dd30bc8

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions

Copy link
Copy Markdown
Contributor

Bundle Size Changes

No bundle size changes.

@Juice10 Juice10 changed the base branch from codex/snapshot-rebuild-utils-boundary to master May 20, 2026 08:25
Copilot AI review requested due to automatic review settings May 20, 2026 08:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors rrweb-snapshot’s former monolithic utils.ts into smaller, domain-focused utility modules while keeping utils.ts as a public compatibility shim (still re-exported from src/index.ts).

Changes:

  • Introduces shared-utils.ts for cross-domain helpers (e.g., Mirror, isElement, extractFileExtension).
  • Introduces snapshot-utils.ts for snapshot-only helpers (CSS serialization, masking, shadow DOM helpers, etc.) and updates snapshot.ts to import from it.
  • Introduces rebuild-utils.ts for rebuild-only helpers (isNodeMetaEqual) and updates rebuild.ts to import from it, while keeping utils.ts as a legacy re-export shim.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/rrweb-snapshot/src/utils.ts Replaced implementation with a compatibility shim that re-exports from the new utility modules.
packages/rrweb-snapshot/src/snapshot.ts Switched internal imports from ./utils to ./snapshot-utils.
packages/rrweb-snapshot/src/snapshot-utils.ts New snapshot-specific utility module (moved logic from old utils.ts).
packages/rrweb-snapshot/src/shared-utils.ts New shared utility module for cross-domain helpers.
packages/rrweb-snapshot/src/rebuild.ts Switched internal imports from ./utils to ./rebuild-utils.
packages/rrweb-snapshot/src/rebuild-utils.ts New rebuild-specific utility module (moved isNodeMetaEqual).
packages/rrweb-snapshot/src/index.ts Keeps legacy export * from './utils' with guidance to prefer narrower internal entrypoints.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +14 to +16
export {
absolutifyURLs,
escapeImportStatement,
@Juice10

Juice10 commented May 20, 2026

Copy link
Copy Markdown
Member Author

decision /w @eoghanmurray: defer it until such time as we can clear and triage the backlog of PRs, .... I think we should be able to do that soon given move to 2.1
here are open PRs that touch that file:
11 open PRs touch packages/rrweb-snapshot/src/utils.ts (see tasklist below)

@eoghanmurray

Copy link
Copy Markdown
Contributor

Also packages/utils/src/index.ts has recording related stuff (mutationobserver) that is included in replay dist outputs where it is not needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants