Skip to content

Asset event attrs in dom #1433

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
63da3e2
Add Asset event type and capture assets
Juice10 Jun 8, 2023
ddab1da
Add test to prove player works
Juice10 Jun 8, 2023
16d89db
Rename `assetCaptureConfig` to `assetCapture`
Juice10 Jun 9, 2023
2986546
Document `assetCapture` config
Juice10 Jun 9, 2023
401b2fd
Create asset event for assets that failed to load
Juice10 Jun 13, 2023
0ffb619
Allow other `yarn dev` commands to depend on @rrweb/types
Juice10 Jun 13, 2023
2fab181
Move types from rrweb-snapshot to @rrweb/types
Juice10 Jun 13, 2023
57d4619
Remove unused import statement
Juice10 Dec 4, 2023
2f76fae
WIP asset manager for replay
Juice10 Jun 13, 2023
56f5aa8
NodeType was moved to @rrweb/types
Juice10 Jun 13, 2023
cbeeb01
Add placeholder tests
Juice10 Nov 23, 2023
a18d0e6
Fix image source attribute in rebuild function
Juice10 Nov 23, 2023
ae020d7
Update path in tsconfig.json
Juice10 Nov 23, 2023
d3c7b7e
Fix asset loading in Replayer
Juice10 Nov 23, 2023
841cd8c
Add todo tests
Juice10 Nov 23, 2023
607ce6d
Add asset mutation events for replayer test
Juice10 Nov 24, 2023
e4ecc0a
Add replay for cached asset on attribute changes
Juice10 Nov 24, 2023
12c18e6
Add isAttributeCacheable and manageAttribute
Juice10 Nov 27, 2023
99d2b21
Move assetCapture params to @rrweb/types and add them to meta events
Juice10 Nov 27, 2023
645c75a
Add asset capture config to meta events
Juice10 Nov 27, 2023
046d179
NodeType was moved to @rrweb/types
Juice10 Nov 27, 2023
d3694f7
NodeType was moved to @rrweb/types
Juice10 Nov 27, 2023
66e13e0
Upgrade jest and rollup in rrweb-snapshot
Juice10 Nov 27, 2023
67a779e
Add check types
Juice10 Nov 27, 2023
71d87d4
Update snapshots to include assetCapture settings
Juice10 Nov 28, 2023
5b4a5b5
Mark `inlineImages` as deprecated in favor of `assetCapture`
Juice10 Nov 28, 2023
180f7fd
Fix rrdom build
Juice10 Nov 28, 2023
015e412
Fix deprecated test
Juice10 Nov 28, 2023
27663f3
Rename `assetCapture` to `captureAssets`
Juice10 Nov 28, 2023
b873923
Remove console.log statements from AssetManager
Juice10 Nov 28, 2023
f1c263b
Check if url is of cacheable origin
Juice10 Nov 30, 2023
ffa46d5
Test: Add captureAssets config to meta event
Juice10 Nov 30, 2023
db94765
object urls aren't stable so lets remove them
Juice10 Nov 30, 2023
634c1ae
inlineImages should work next to captureAssets for now
Juice10 Nov 30, 2023
d756e61
Fix asset caching bug
Juice10 Dec 1, 2023
7ae4dd4
captureAssets on live-stream by default
Juice10 Dec 1, 2023
c1d73ce
Fix asset URLs in events file
Juice10 Dec 1, 2023
f0050df
Update deprecated inlineImages option to use
eoghanmurray Apr 22, 2024
37af341
Deprecate inlineImage config
Juice10 Dec 4, 2023
c47f9cd
Update snapshot to reflect current captureAssets
Juice10 Dec 4, 2023
c171342
Make test less flaky
Juice10 Dec 4, 2023
d5364e5
Cache attribute support for BODY, TABLE,
Juice10 Dec 4, 2023
7c43890
Remove unused 'inlineImages' option
Juice10 Dec 4, 2023
2ab47a2
Refactor AssetManager constructor signature
Juice10 Dec 4, 2023
6546dbd
Remove console.log statements in asset.test.ts
Juice10 Dec 4, 2023
55c24fa
Refactor reset method signature to accept optional
Juice10 Dec 4, 2023
fa6e086
Fix deserialized size comparison in deserializeArg
Juice10 Dec 4, 2023
5516780
Apply formatting changes
Juice10 Dec 4, 2023
8598eab
Fix asset manager to only load assets from
Juice10 Dec 4, 2023
2c12cab
Add cacheRoot option to typescript plugin in
Juice10 Dec 4, 2023
2a25fec
Add cacheRoot option to tsconfigOverride in
Juice10 Dec 4, 2023
44fbc10
Update defaultPort in startServer function
Juice10 Dec 4, 2023
445c7bb
Make test more reliable
Juice10 Dec 4, 2023
9bc508a
Add failing test for src attribute
Juice10 Dec 11, 2023
a236dea
Remove failed asset event
Juice10 Dec 11, 2023
6bc2164
Add support for asset manager in rrdom
Juice10 Dec 12, 2023
9c8a2fc
Change asset manager path
Juice10 Dec 14, 2023
4a937aa
Fix import path for AssetManager in asset-unit.test.ts
Juice10 Dec 14, 2023
a2d91b8
Move isAttributeCacheable tests to rrweb-snapshot
Juice10 Dec 14, 2023
d81d6d3
Make assetManager optional
Juice10 Dec 14, 2023
a4d7bdb
upgrade rrdom-nodejs to jest 29
Juice10 Dec 14, 2023
99a22ce
Update Jest and ts-jest versions to 29 in rrvideo
Juice10 Dec 14, 2023
b729dc9
add @types/prettier dependency
Juice10 Dec 14, 2023
8c69bd7
Update tsconfig.json files with Node module resolution
Juice10 Dec 14, 2023
535a1c2
upgrade dependencies
Juice10 Dec 14, 2023
3fe1e80
Update jest to 29 and rollup to 4
Juice10 Dec 14, 2023
2593269
Add esModuleInterop and allowSyntheticDefaultImports to tsconfig.json
Juice10 Dec 14, 2023
cfb0571
Add support for updating srcset attribute in
Juice10 Dec 15, 2023
faff4b9
Add support for SVG elements in AssetManager
Juice10 Dec 15, 2023
1abf3dc
Drop support for caching xlink:href attributes
Juice10 Dec 15, 2023
d7030c0
Fix rrdom error:
Juice10 Dec 15, 2023
c04ef80
Upgrade to jest-environment-jsdom 30-alpha.2
Juice10 Dec 15, 2023
621f8c5
Remove console.log statement in
Juice10 Dec 15, 2023
7d7aac8
Linux and Mac generate slightly different screenshots
Juice10 Dec 15, 2023
d1db95e
Add wait for RAF before evaluating snapshots
Juice10 Dec 15, 2023
9fcdeae
Changeset: Added support for Asset Event and capturing many
Juice10 Dec 15, 2023
f5af50b
Update puppeteer version in package.json
Juice10 Jan 16, 2024
cf1f6a3
Fix cross-origin iframe message forwarding test
Juice10 Jan 16, 2024
085e524
Make test more robust
Juice10 Jan 16, 2024
57a167c
Deprecate `inlineImages` and introduce `captureAssets` option
Juice10 Feb 5, 2024
cd730d4
Docs: add examples to `getUrlsFromSrcset`
Juice10 Feb 5, 2024
9532d77
Move @rrweb/types to devDependencies for rrweb-snapshot
Juice10 Feb 6, 2024
a132f63
Remove console.log statements in asset-integration.test.ts
Juice10 Mar 18, 2024
5c659bd
Update packages/rrweb/src/replay/asset-manager/index.ts
Juice10 Mar 20, 2024
34e8047
Delay call until all attributes are present on the new node, in case …
eoghanmurray Mar 25, 2024
07be53c
Rename Cacheable -> Capturable
eoghanmurray Mar 25, 2024
a795544
Indicate the presence of deferred assets using new `rr_captured_*` at…
eoghanmurray Mar 25, 2024
7806c45
Revert attributes in non-live mode and ensure this happens when we ca…
eoghanmurray Mar 27, 2024
b22ed45
Only record certain iframes as assets as we don't want to override th…
eoghanmurray Mar 27, 2024
cec8313
Fixup: we don't need template strings here
eoghanmurray Mar 28, 2024
ff49d73
Ensure we correctly distinguish between html <iframes> and other exot…
eoghanmurray Mar 28, 2024
90af2c6
Bump timeouts here as I was getting failures when running whole test …
eoghanmurray Mar 28, 2024
bd10593
Add an `asset` type which includes the element; a bit of prep work fo…
eoghanmurray Mar 28, 2024
591698d
This function was replaced by getSourcesFromSrcset which ultimately d…
eoghanmurray Apr 2, 2024
fc12a99
Refactor and prepare for some changes: Deal with the difference betwe…
eoghanmurray Apr 3, 2024
2a45198
Create assetStatus type as per Justin's request
eoghanmurray Apr 3, 2024
bd9d3c6
Default to headless on retest
eoghanmurray Mar 28, 2024
e9b7f28
A convenience command to run prettier against files that have just be…
eoghanmurray Apr 3, 2024
ba9d5a2
Fix types as per suggestions from code review
Juice10 Apr 5, 2024
24dc37c
Update packages/rrweb/src/replay/canvas/2d.ts
Juice10 Apr 5, 2024
2145f52
Remove function not used since #995
eoghanmurray Apr 16, 2024
1470f1a
Don't rename attrs of assets which will be refused according to initi…
eoghanmurray Apr 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/pretty-candles-chew.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'rrweb-snapshot': minor
'rrweb': minor
'rrdom': patch
'@rrweb/types': patch
---

Added support for Asset Event and capturing many different types of assets (not just img#src)
9 changes: 9 additions & 0 deletions .changeset/wise-pens-peel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'rrweb-snapshot': major
'rrweb': major
---

`inlineImages` recording option has been deprecated and is now an alias for `captureAssets: { objectURLs: true, origins: true }`.
Please see [asset recording documentation](/docs/recipes/assets.md) for more information.

The reason we deprecated `inlineImages` is because it modified events after they where already emitted, which could lead to events being saved without the corresponding images. The new `captureAssets` option records assets as a separate event, ensuring that all assets are recorded and events are not modified after they are emitted.
8 changes: 8 additions & 0 deletions .changeset/yellow-vans-protect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'rrweb-snapshot': major
'@rrweb/types': patch
---

`NodeType` enum was moved from rrweb-snapshot to @rrweb/types
The following types where moved from rrweb-snapshot to @rrweb/types: `documentNode`, `documentTypeNode`, `attributes`, `legacyAttributes`, `elementNode`, `textNode`, `cdataNode`, `commentNode`, `serializedNode`, `serializedNodeWithId` and `DataURLOptions`
`inlineImage` config option is deprecated and in `rrweb` is an alias for `captureAssets` config option
3 changes: 2 additions & 1 deletion .vscode/rrweb-monorepo.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
" rrweb monorepo",
"rrweb-player (package)",
"@rrweb/types"
]
],
"typescript.tsdk": " rrweb monorepo/node_modules/typescript/lib"
}
}
40 changes: 40 additions & 0 deletions docs/recipes/assets.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Asset Capture Methods & Configuration in rrweb

[rrweb](https://rrweb.io/) is a JavaScript library that allows you to record and replay user interactions on your website. It provides various configuration options for capturing assets (such as images) during the recording process. In this document, we will explore the different asset capture methods and their configuration options in rrweb.

## Inline Images (Deprecated)

The `inlineImages` configuration option is deprecated and should not be used anymore. The previous implementation had some issues, namely rewriting events that are already emitted which might make you miss the inlined image if the event has already been sent to the server. Currently it just turns on `captureAssets`, so use please directly use the `captureAssets` option to configure asset capture.

## Asset Capture Configuration

The `captureAssets` configuration option allows you to customize the asset capture process. It is an object with the following properties:

- `objectURLs` (default: `true`): This property specifies whether to capture same-origin `blob:` assets using object URLs. Object URLs are created using the `URL.createObjectURL()` method. Setting `objectURLs` to `true` enables the capture of object URLs.

- `origins` (default: `false`): This property determines which origins to capture assets from. It can have the following values:
- `false` or `[]`: Disables capturing any assets apart from object URLs.
- `true`: Captures assets from all origins.
- `[origin1, origin2, ...]`: Captures assets only from the specified origins. For example, `origins: ['https://s3.example.com/']` captures all assets from the origin `https://s3.example.com/`.

## TypeScript Type Definition

Here is the TypeScript type definition for the `recordOptions` object, which includes the asset capture configuration options:

```typescript
export type recordOptions<T> = {
// Other configuration options...
captureAssets?: {
objectURLs: boolean;
origins: string[] | true | false;
};
inlineImages?: boolean; // Deprecated, don't use it anymore
// Other configuration options...
};
```

This type definition shows that `captureAssets` is an optional property of the `recordOptions` object. It contains the `objectURLs` and `origins` properties, which have the same meanings as described above.

## Conclusion

By configuring the `captureAssets` option in rrweb, you can control how assets like images are captured during the recording process. This allows you to customize which assets are included in the recorded interactions on your website.
40 changes: 40 additions & 0 deletions docs/recipes/assets.zh_CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# rrweb 中的资源捕获方法和配置

[rrweb](https://rrweb.io/) 是一个 JavaScript 库,允许您记录并重放您网站上的用户互动。它为捕获资产(如图像)提供了各种配置选项。在本文档中,我们将探讨 rrweb 中不同的资源捕获方法及其配置选项。

## 内联图像(已弃用)

`inlineImages` 配置选项已弃用,不应再使用。之前的实现存在一些问题,即重写已经发出的事件,这可能使您错过已经发送到服务器的内联图像。目前它只是开启了 `captureAssets`,所以请直接使用 `captureAssets` 选项来配置资源捕获。

## 资源捕获配置

`captureAssets` 配置选项允许您自定义资源捕获过程。它是一个具有以下属性的对象:

- `objectURLs`(默认值:`true`):此属性指定是否使用对象 URL 捕获同源 `blob:` 资源。对象 URL 是使用 `URL.createObjectURL()` 方法创建的。将 `objectURLs` 设置为 `true` 可以启用对象 URL 的捕获。

- `origins`(默认值:`false`):此属性确定从哪些来源捕获资源。它可以有以下值:
- `false` 或 `[]`:除了对象 URL 之外,不捕获任何资源。
- `true`:从所有来源捕获资源。
- `[origin1, origin2, ...]`:仅从指定的来源捕获资源。例如,`origins: ['https://s3.example.com/']` 从 `https://s3.example.com/` 来源捕获所有资源。

## TypeScript 类型定义

这是 `recordOptions` 对象的 TypeScript 类型定义,其中包括资源捕获配置选项:

```typescript
export type recordOptions<T> = {
// 其他配置选项...
captureAssets?: {
objectURLs: boolean;
origins: string[] | true | false;
};
inlineImages?: boolean; // 已弃用
// 其他配置选项...
};
```

这种类型定义表明 captureAssets 是 recordOptions 对象的一个可选属性。它包含 objectURLs 和 origins 属性,其含义与上述相同。

## 结论

通过在 rrweb 中配置 captureAssets 选项,您可以控制在记录过程中如何捕获像图像这样的资源。这允许您
Loading
Loading