Commit Graph

186 Commits

Author SHA1 Message Date
Yun Feng
72874f2fd2 add Eslint action and update travis CI (#931)
* refactor: eliminate eslint errors as many as I can

* refactor: fix more eslint errors in the record module

* LINT: fix @typescript-eslint/unbound-method

* LINT: fix all eslint errors in source code

* LINT: fix as many eslint warnings as possible

* CI: add a github action to check ESLINT status

* CI: update github action

* build: update travis CI and github action

* CI: update github action

* CI: update job name

* CI: restore test command from turbo to lerna

* Merge branch master into eslint-action

Co-authored-by: Justin Halsall <Juice10@users.noreply.github.com>
2022-07-10 16:15:48 +08:00
Yun Feng
01612b7a75 update cssom package to rrweb self-owned package 'rrweb-cssom' (#925)
* test: update cssom package to rrweb self-owned package 'rrweb-cssom'

* style: remove outdated comments
2022-07-02 13:55:45 +08:00
yz-yu
af8ed5513c unify typescript version and rollup plugins (#921) 2022-06-25 21:08:06 +08:00
yz-yu
d35110521a integrate turborepo in monorepo (#918)
* integrate turborepo in monorepo

* integrate turborepo in monorepo
2022-06-20 22:55:10 +08:00
yz-yu
74f553afc3 move browser-only rrdom features to the new rrdom package (#913) 2022-06-20 22:02:21 +08:00
Justin Halsall
058c4579b4 Speed up snapshotting of many new dom nodes (#903)
* Speed up snapshotting of many new dom nodes

By avoiding reflow we shave about 15-25% off our snapshotting time

* Improve newlyAddedElement docs

* Optimize needMaskingText by using el.closest and less recursion

* Serve all rrweb dist files

* Split serializeNode into smaller functions

Makes it easier to profile

* Slow down cpu enhance tracing on fast machines

* Increase timeout

* Perf: only loop through ancestors when they have something to compare to

* Perf: `hasNode` is cheaper than `getMeta`

* Perf: If parents where already checked, no need to do it again

* Perf: reverse for loops are faster

Because they only do the .lenght check once. In this case I don't think we'll see much performance gains if any

* Clean up code

* Perf: check ancestors once with isBlocked

* guessing this might fixes canvas test

* Update packages/rrweb/src/record/observers/canvas/webgl.ts

Co-authored-by: yz-yu <yanzhen@smartx.com>

* Fix #904 (#906)

Properly remove crossorigin attribute

* Bump minimist from 1.2.5 to 1.2.6 (#902)

Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

Co-authored-by: yz-yu <yanzhen@smartx.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-06 22:55:15 +08:00
Justin Halsall
1355917e1b Chore: Add issue/pr template and general housekeeping tools and docs (#900)
* Add linting

* Add issue templates and docs

* Add root eslint config and remove tslint

* Autofix lint issues
2022-05-22 09:59:42 +08:00
Justin Halsall
de755ae577 #853 Second try: fast-forward implementation v2: virtual dom optimization (#895)
* rrdom: add a diff function for properties

* implement diffChildren function and unit tests

* finish basic functions of diff algorithm

* fix several bugs in the diff algorithm

* replace the virtual parent optimization in applyMutation()

* fix: moveAndHover after the diff algorithm is executed

* replace virtual style map with rrdom

cssom version has to be above 0.5.0 to pass virtual style tests

* fix: failed virtual style tests in replayer.test.ts

* fix: failed polyfill tests caused by nodejs compatibility of different versions

* fix: svg viewBox attribute doesn't work

Cause the attribute viewBox is case sensitive, set value for viewbox doesn't work

* feat: replace treeIndex optimization with rrdom

* fix bug of diffProps and disable smooth scrolling animation in fast-forward mode

* feat: add iframe support

* fix: @rollup/plugin-typescript build errors in rrweb-player

Error: @rollup/plugin-typescript TS1371: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'

* fix: bug when fast-forward input events and add test for it

* add test for fast-forward scroll events

* fix: custom style rules don't get inserted into some iframe elements

* code style tweak

* fix: enable to diff iframe elements

* fix  the jest error "Unexpected token 'export'"

* try to fix build error of rrweb-player

* correct the attributes definition in rrdom

* fix: custom style rules are not inserted in some iframes

* add support for shadow dom

* add support for MediaInteraction

* add canvas support

* fix unit test error in rrdom

* add support for Text, Comment

* try to refactor RRDom

* refactor RRDom to reduce duplicate code

* rename document-browser to virtual-dom

* increase the test coverage for document.ts and add ownerDocument for it

* Merge branch 'master' into virtual-dom

* add more test for virtual-dom.ts

* use cssstyle in document-nodejs

* fix: bundle error

* improve document-nodejs

* enable to diff scroll positions of an element

* rename rrdom to virtualDom for more readability and make the tree public

* revert unknown change

* improve the css style parser for comments

* improve code style

* update typings

* add handling for the case where legacy_missingNodeRetryMap is not empty

* only import types from rrweb into rrdom

* Apply suggestions from code review

Co-authored-by: Justin Halsall <Juice10@users.noreply.github.com>

* Apply suggestions from code review

* fix building error in rrweb

* add a method setDefaultSN to set a default value for a RRNode's __sn

* fix rrweb test error and bump up other packages

* add support for custom property of css styles

* add a switch for virtual-dom optimization

* Apply suggestions from code review

1. add an enum type for NodeType
2. rename nodeType from rrweb-snapshot to RRNodeType
3. rename notSerializedId to unserializedId
4. add comments for some confusing variables

* adapt changes of #865 to virtual-dom and improve the test case for more coverage

* apply review suggestions

https://github.com/rrweb-io/rrweb/pull/853#pullrequestreview-922474953

* tweak the diff algorithm

* add description of the flag useVirtualDom and remove outdated logConfig

* Remove console.log

* Contain changes to document

* Upgrade rollup to 2.70.2

* Revert "Upgrade rollup to 2.70.2"

This reverts commit b1be81a2a76565935c9dc391f31beb7f64d25956.

* Fix type checking rrdom

* Fix typing error while bundling

* Fix tslib error on build

Rollup would output the following error:
`semantic error TS2343: This syntax requires an imported helper named '__spreadArray' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'.`

* Increase memory limit for rollup

* Use esbuild for bundling

Speeds up bundling significantly

* Avoid circular dependencies and import un-bundled rrdom

* Fix imports

* Revert back to pre-esbuild

This reverts the following commits:
b7b3c8dbaa551a0129da1477136b1baaad28e6e1
72e23b8e27f9030d911358d3a17fe5ad1b3b5d4f
85d600a20c56cfa764cf1f858932ba14e67b1d23
61e1a5d323212ca8fbe0569e0b3062ddd53fc612

* Set node to lts (12 is no longer supported)

* Speed up bundling and use less memory

This fixes the out of memory errors happening while bundling

* remove __sn from rrdom

* fix typo

* test: add a test case for StyleSheet mutation exceptions while fast-forwarding

* rename Array.prototype.slice.call() to Array.from()

* improve test cases

* fix: PR #887 in 'virtual-dom' branch

* apply justin's suggestion on 'Array.from' refactor

related commit 0f6729d27a323260b36fbe79485a86715c0bc98a

* improve import code structure

Co-authored-by: Yun Feng <yun.feng@anu.edu.au>
2022-05-12 12:01:13 +08:00
Lucky Feng
320a454c49 rrdom (#613)
* create rrdom package

* test(rrdom): add unit tests for polyfill.ts

* fix(rrweb snapshot): type check errors

Errors are caused by the declaration similarity of @types/mocha and @types/jest if we install both of them in the whole project.

* Set tagNames to upper case by default

This mirrors the `Element.tagName` implementation:

```
For DOM trees which represent HTML documents, the returned tag name is always in the canonical upper-case form. For example, tagName called on a <div> element returns "DIV".
```
https://developer.mozilla.org/en-US/docs/Web/API/Element/tagName

* Add workspace file

* VSCode settings for rrdom tests

* Add basic test for RRDocument

* Only setup jest tests for rrdom

* mock Node type and Event type for nodejs environment

* test(rrdom): add snapshot for document.test.ts

* fix issue of nwsapi import and add unit tests for rrdom

* fix: querySelectorAll returns nothing when querying elements with ids and classNames

* fix: error of unit test for Event polyfill

Since Event class is built in nodejs after v15.0.0

* add a dummy implementation of canvas

* add style element support

* add unit test for style element

Co-authored-by: Justin Halsall <Juice10@users.noreply.github.com>
2022-01-11 23:15:57 +08:00
Justin Halsall
a261f3d4de add root scripts and update contribution guide (#750) 2021-11-06 09:00:07 +08:00
yz-yu
6483a594ac update repl tools and script, close #338 (#722) 2021-10-07 14:14:58 +08:00
Yanzhen Yu
83ef4138aa update lerna scripts 2021-09-11 22:46:06 +08:00
Yanzhen Yu
9571c36d80 add lerna to manage monorepo 2021-08-14 23:58:56 +08:00
Mark-fenng
6c34ffa7ce moved rrweb into packages/rrweb 2021-07-22 23:43:52 +08:00
Yanzhen Yu
ca8d9701fa Release 1.0.2 2021-07-19 22:29:20 +08:00
Yanzhen Yu
6b01f2489b upgrade rrweb-snapshot to 1.1.7
ignore prefetch and preload script links
close #52, #297, #597

Handle quoted strings in data url
2021-07-18 14:08:03 +08:00
yz-yu
ca8317b56f use prettier instead of node-libtidy (#638) 2021-07-18 10:49:16 +08:00
Justin Halsall
6ef260089f Add check-types to package.json (#627)
* Add type checking to ci

* Update @types/node to version 12

We are using node 12 on ci

* Add check-types to package.json
2021-07-13 23:46:45 +08:00
Justin Halsall
016ad90973 Add type checking to ci (#626)
* Add type checking to ci

* Update @types/node to version 12

We are using node 12 on ci
2021-07-13 22:31:45 +08:00
Justin Halsall
39c8ba1a24 Buffer modifications to virtual stylesheets (#618)
* Fix sheet insertion

Restore skip duration

Use virtualStyleRulesMap to re-populate stylesheet on Flush event

Clear virtualStyleRulesMap after flush applied

* Support rule deletion in virtual processing

* Simply restoreNodeSheet with early aborts

* Encountered a bug where firstFullSnapshot was played twice because timer was immediately started and reached the snapshot before the setTimeout returned

* Ignoring a FullSnapshot needs to be a one-time only thing, as otherwise we'll ignore it after scrubbing (restarting play head at a particular time). This is a problem if mutations have altered the player state, and we try to replay those mutations, so we e.g. try to remove an element that has already been removed because we haven't reset the FullSnapshot state

* Some `npm run typings` related fixups

* add basic html snapshot functionality

* move restoreNodeSheet to it's own module

* Refactor virtual style rules to buffer changes.
Only applies changes on flush.

`virtualStyleRulesMap` now works with strings instead of CSSRules.
CSSRules can only be via made `.insertRule` on CSSStyleSheet in most browsers.
And `new CSSStyleSheet()` only works in Chrome currently.

* remove unused code

* move VirtualStyleRules from CSSRule to string in tests

* correct paths for tests

* naming

* create and restore style snapshots for virtual nodes

* update replayer snapshot

* move storeCSSRules to virtual-styles.ts

* try/catch access to .sheet in case of access errors

* clean up tests

Co-authored-by: Vladimir Milenko <vladimir.milenko@uber.com>
Co-authored-by: Eoghan Murray <eoghan@getthere.ie>
2021-07-08 22:34:02 +08:00
Yanzhen Yu
c658ee9e01 Release 1.0.1 2021-07-06 12:13:25 +08:00
Yanzhen Yu
55f7f4f5d2 Release 1.0.0 2021-07-06 00:25:08 +08:00
Yanzhen Yu
924c8991da Release 1.0.0-beta.2 2021-07-01 11:22:52 +08:00
Yanzhen Yu
8082b05254 Release 1.0.0-beta.1 2021-07-01 10:46:47 +08:00
Justin Halsall
ed37401f63 Mask value attribute changes for elements in maskInputOptions (#602)
* mask value attribute changes for elements in maskInputOptions

* refactor initInputObserver to use maskInputValue

* add todo

* Fix typo

* upgrade rrweb-snapshot to 1.1.6

* move maskInputValue to rrweb-snapshot
2021-06-30 23:26:16 +08:00
bachmanity1
dee0457ffe add keepIframeSrcFn option (#592)
* rename allowIframe to keepIframeSrcFn

* update rrweb-snapshot to 1.1.5
2021-06-30 11:51:27 +08:00
Yanzhen Yu
c2e042ca6c Release 1.0.0-beta.0 2021-06-20 21:40:16 +08:00
Justin Halsall
8a9212fed4 Tests: Iframe event order (#568)
* add failing test

* assert order of events

* defer attaching of iframe till FullSnapshot is done
Fixes: https://github.com/rrweb-io/rrweb/issues/567

* correct event order in iframe integration test snapshot

* trigger build

* trigger build

* Move settimeout responsibility to snapshot
https://github.com/rrweb-io/rrweb-snapshot/pull/78

* upgrade rrweb-snapshot to 1.1.4

* DRY record tests

* cleanup

* Upgrade puppeteer to 9.1.1
for (hopefully) more consistent behaviour between CI and development

* make input bigger to prevent triggering scroll events

* page.waitFor is deprecated
more info: https://github.com/puppeteer/puppeteer/issues/6214

* Set os and distro for Travis ci

Co-authored-by: yz-yu <yanzhen@smartx.com>
2021-06-17 21:02:42 +08:00
Yanzhen Yu
2c90543660 update rrweb-snapshot 2021-06-17 20:19:04 +08:00
re-fort
18ad3dae1a Add options to mask texts (#540)
* feat: add options to mask texts

* feat: add the default mask function

* refactor: rename options to identify the difference between  mask text and mask input

* test: add tests about masking

* doc: add options about masking

* chore: bump up rrweb-snapshot version
2021-04-22 16:03:52 +08:00
Yanzhen Yu
df7537b01d impl shadow DOM manager
part of #38
1. observe DOM mutations in shadow DOM
2. rebuild DOM mutations in shadow DOM
2021-03-28 18:16:54 +08:00
Yanzhen Yu
ac60676321 rename node_modules in es bundle to ext 2021-03-21 14:53:51 +08:00
Justin Halsall
918f7f36fe Add yarn support for installing unreleased rrweb as a dependency (#497)
* Use prepack instead of prepare for yarn support

* add prepare and prepack

for yarn v1 & v2 compatibility

* Create .npmignore
2021-02-19 11:57:01 +08:00
Filip Slatinac
7bf1b450f6 Adding prepare npm statement (#490)
* added prepare statement

* using master rrweb snapshot

Co-authored-by: filip slatinac <filipslatinac@MacBook-Pro-2.local>
2021-02-18 21:15:01 +08:00
Yanzhen Yu
1dd393a2de upgrade rrweb-snapshot to 1.0.7 2021-02-18 12:05:31 +08:00
Moji Izadmehr
924a4c8986 Add prettier as a dependency (#487) 2021-02-13 21:50:03 +08:00
yz-yu
f3d7fa3451 Impl record iframe (#481)
* Impl record iframe

* iframe observe

* temp: add bundle file to git

* update bundle

* update with pick

* update bundle

* fix fragment map remove

* feat: add an option to determine whether to pause CSS animation when playback is paused (#428)

set pauseAnimation to true by default

* fix: elements would lose some states like scroll position because of "virtual parent" optimization (#427)

* fix: elements would lose some state like scroll position because of "virtual parent" optimization

* refactor: the bugfix code

bug: elements would lose some state like scroll position because of "virtual parent" optimization

* fix: an error occured at applyMutation(remove nodes part)

error message:
Uncaught (in promise) DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node

* pick fixes

* revert ignore file

* re-impl iframe record

* re-impl iframe replay

* code housekeeping

* move multi layer dimension calculation to replay side

* update test cases

* teardown test server

* upgrade rrweb-snapshot with iframe load timeout

Co-authored-by: Lucky Feng <yun.feng@smartx.com>
2021-02-10 21:44:25 +08:00
Yanzhen Yu
34c74445ba read __rrMutationObserver from window 2021-02-04 15:00:14 +08:00
Yanzhen Yu
4a73f6de1c Release 0.9.14 2021-01-16 22:33:28 +08:00
Yanzhen Yu
c01d6a9bc1 upgrade 0.9.14 2021-01-16 22:32:28 +08:00
Yanzhen Yu
7f2c242782 Release 0.9.13 2021-01-08 14:07:55 +08:00
Yanzhen Yu
d76e4753f4 Release 0.9.12 2021-01-02 14:59:05 +08:00
101arrowz
e946b69d3f Update to fflate (#448)
* Update to fflate

* Update docs, bundler config
2020-12-22 20:40:37 +08:00
Yanzhen Yu
e3beeb445a Release 0.9.11 2020-11-29 14:54:55 +08:00
Yanzhen Yu
48edcfbdee Release 0.9.10 2020-11-29 14:41:22 +08:00
Yanzhen Yu
64c5f613ff upgrade rrweb-snapshot 2020-11-29 14:40:28 +08:00
Yanzhen Yu
7d817be155 upgrade to rrweb-snapshot v1.0 2020-11-29 13:54:37 +08:00
Yanzhen Yu
476ae33d7a Release 0.9.9 2020-10-26 23:34:44 +08:00
Yanzhen Yu
7d5d003325 upgrade rrweb-snapshot 2020-10-24 16:36:06 +08:00
Yanzhen Yu
0e63852bbc Release 0.9.8 2020-10-23 13:49:37 +08:00