Skip to content
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 0 additions & 47 deletions .github/workflows/eslint.yml

This file was deleted.

18 changes: 0 additions & 18 deletions .github/workflows/release.yml

This file was deleted.

21 changes: 9 additions & 12 deletions .github/workflows/style-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ on: [push, pull_request_target]
jobs:
eslint_check_upload:
runs-on: ubuntu-latest
name: ESLint Check and Report Upload
name: Build & ESLint Check

steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: 16.15.0
registry-url: https://registry.npmjs.org
node-version: 16
- name: Install
run: YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn
- name: Build Packages
Expand Down Expand Up @@ -48,33 +47,31 @@ jobs:

prettier_check:
# In the forked PR, it's hard to format code and push to the branch directly, so the action only check the format correctness.
if: github.event_name != 'push' && github.event.pull_request.head.repo.full_name != 'rrweb-io/rrweb'
if: github.event_name != 'push'
runs-on: ubuntu-latest
name: Format Check
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: 16.15.0
registry-url: https://registry.npmjs.org
node-version: 16
- name: Install
run: YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn
- name: Prettier Check
run: yarn prettier --check '**/*.{ts,md}'

prettier:
# Skip the format code action in forked PRs
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == 'rrweb-io/rrweb'
if: github.event_name == 'push'
runs-on: ubuntu-latest
name: Format Code
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: 16.15.0
registry-url: https://registry.npmjs.org
node-version: 16
- name: Install
run: YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn
- name: Prettify Code
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"eslint-plugin-tsdoc": "^0.2.16",
"markdownlint": "^0.25.1",
"markdownlint-cli": "^0.31.1",
"prettier": "^2.7.1",
"turbo": "^1.2.4",
"typescript": "^4.7.3"
},
Expand Down
8 changes: 4 additions & 4 deletions packages/rrdom-nodejs/src/document-nodejs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class RRDocument
extends BaseRRDocumentImpl(RRNode)
implements IRRDocument
{
readonly nodeName: '#document' = '#document';
readonly nodeName = '#document' as const;
private _nwsapi: NWSAPI;
get nwsapi() {
if (!this._nwsapi) {
Expand Down Expand Up @@ -374,15 +374,15 @@ export class RRIFrameElement extends RRElement {
}

export class RRText extends BaseRRTextImpl(RRNode) {
readonly nodeName: '#text' = '#text';
readonly nodeName = '#text' as const;
}

export class RRComment extends BaseRRCommentImpl(RRNode) {
readonly nodeName: '#comment' = '#comment';
readonly nodeName = '#comment' as const;
}

export class RRCDATASection extends BaseRRCDATASectionImpl(RRNode) {
readonly nodeName: '#cdata-section' = '#cdata-section';
readonly nodeName = '#cdata-section' as const;
}

interface RRElementTagNameMap {
Expand Down
8 changes: 4 additions & 4 deletions packages/rrdom/src/document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export function BaseRRDocumentImpl<
>(RRNodeClass: RRNode) {
return class BaseRRDocument extends RRNodeClass implements IRRDocument {
public readonly nodeType: number = NodeType.DOCUMENT_NODE;
public readonly nodeName: '#document' = '#document';
public readonly nodeName = '#document' as const;
public readonly compatMode: 'BackCompat' | 'CSS1Compat' = 'CSS1Compat';
public readonly RRNodeType = RRNodeType.Document;
public textContent: string | null = null;
Expand Down Expand Up @@ -604,7 +604,7 @@ export function BaseRRTextImpl<RRNode extends ConstrainedConstructor<IRRNode>>(
// @ts-ignore
return class BaseRRText extends RRNodeClass implements IRRText {
public readonly nodeType: number = NodeType.TEXT_NODE;
public readonly nodeName: '#text' = '#text';
public readonly nodeName = '#text' as const;
public readonly RRNodeType = RRNodeType.Text;
public data: string;

Expand Down Expand Up @@ -634,7 +634,7 @@ export function BaseRRCommentImpl<
// @ts-ignore
return class BaseRRComment extends RRNodeClass implements IRRComment {
public readonly nodeType: number = NodeType.COMMENT_NODE;
public readonly nodeName: '#comment' = '#comment';
public readonly nodeName = '#comment' as const;
public readonly RRNodeType = RRNodeType.Comment;
public data: string;

Expand Down Expand Up @@ -666,7 +666,7 @@ export function BaseRRCDATASectionImpl<
extends RRNodeClass
implements IRRCDATASection
{
public readonly nodeName: '#cdata-section' = '#cdata-section';
public readonly nodeName = '#cdata-section' as const;
public readonly nodeType: number = NodeType.CDATA_SECTION_NODE;
public readonly RRNodeType = RRNodeType.CDATA;
public data: string;
Expand Down
3 changes: 1 addition & 2 deletions packages/rrdom/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
"lib": ["es6", "dom"],
"skipLibCheck": true,
"declaration": true,
"importsNotUsedAsValues": "error",
"composite": true
"importsNotUsedAsValues": "error"
},
"references": [
{
Expand Down
2 changes: 1 addition & 1 deletion packages/rrweb-player/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "1.0.1",
"private": true,
"devDependencies": {
"@rollup/plugin-commonjs": "^22.0.0",
"@rollup/plugin-commonjs": "22.0.0",
"@rollup/plugin-node-resolve": "^13.2.1",
"@types/offscreencanvas": "^2019.6.4",
"eslint": "^8.23.1",
Expand Down
76 changes: 0 additions & 76 deletions packages/rrweb-player/typings/index.d.ts

This file was deleted.

4 changes: 2 additions & 2 deletions packages/rrweb-snapshot/src/rebuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,10 @@ function buildNode(
/**
* Find all remote fonts in the style tag.
* We need to find and replace the URLs with a proxy URL so we can bypass CORS.
*
*/
if (typeof value === 'string') {
const regex =
/url\(\"https:\/\/\S*(.eot|.woff2|.ttf|.woff)\S*\"\)/gm;
const regex = /url\("https:\/\/\S*(.eot|.woff2|.ttf|.woff)\S*"\)/gm;
let m;
const fontUrls: { originalUrl: string; proxyUrl: string }[] = [];

Expand Down
2 changes: 1 addition & 1 deletion packages/rrweb-snapshot/test/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as typescript from 'rollup-plugin-typescript2';
import * as assert from 'assert';
import { waitForRAF } from './utils';

const _typescript = (typescript as unknown) as () => rollup.Plugin;
const _typescript = typescript as unknown as () => rollup.Plugin;

const htmlFolder = path.join(__dirname, 'html');
const htmls = fs.readdirSync(htmlFolder).map((filePath) => {
Expand Down
20 changes: 10 additions & 10 deletions packages/rrweb/src/replay/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -449,20 +449,20 @@ export class Replayer {
const currentInterval = userInteractionEvents[i - 1];
const _event = userInteractionEvents[i];
if (
_event.timestamp! - currentInterval.timestamp! >
_event.timestamp - currentInterval.timestamp >
SKIP_TIME_THRESHOLD
) {
allIntervals.push({
startTime: currentInterval.timestamp!,
endTime: _event.timestamp!,
duration: _event.timestamp! - currentInterval.timestamp!,
startTime: currentInterval.timestamp,
endTime: _event.timestamp,
duration: _event.timestamp - currentInterval.timestamp,
active: false,
});
} else {
allIntervals.push({
startTime: currentInterval.timestamp!,
endTime: _event.timestamp!,
duration: _event.timestamp! - currentInterval.timestamp!,
startTime: currentInterval.timestamp,
endTime: _event.timestamp,
duration: _event.timestamp - currentInterval.timestamp,
active: true,
});
}
Expand Down Expand Up @@ -863,16 +863,16 @@ export class Replayer {
if (this.config.skipInactive && !this.inactiveEndTimestamp) {
for (const interval of this.getActivityIntervals()) {
if (
timestamp >= interval.startTime! &&
timestamp < interval.endTime! &&
timestamp >= interval.startTime &&
timestamp < interval.endTime &&
!interval.active
) {
this.inactiveEndTimestamp = interval.endTime;
break;
}
}
if (this.inactiveEndTimestamp) {
const skipTime = this.inactiveEndTimestamp! - timestamp!;
const skipTime = this.inactiveEndTimestamp - timestamp;
const payload = {
speed:
(skipTime / SKIP_DURATION_LIMIT) * this.config.inactiveSkipTime <
Expand Down
6 changes: 2 additions & 4 deletions packages/rrweb/test/events/style-sheet-rule-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,7 @@ const events: eventWithTime[] = [
id: 101,
adds: [
{
rule:
'.css-added-at-500-overwritten-at-3000 {border: 1px solid blue;}',
rule: '.css-added-at-500-overwritten-at-3000 {border: 1px solid blue;}',
index: 1,
},
],
Expand All @@ -162,8 +161,7 @@ const events: eventWithTime[] = [
id: 105,
adds: [
{
rule:
'.css-added-at-1000-deleted-at-2500{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;min-width:60rem;min-height:100vh;color:blue;}',
rule: '.css-added-at-1000-deleted-at-2500{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;min-width:60rem;min-height:100vh;color:blue;}',
index: 2,
},
],
Expand Down
2 changes: 1 addition & 1 deletion packages/rrweb/test/packer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('pack', () => {

describe('unpack', () => {
it('is compatible with unpacked data 1', () => {
const result = unpack((event as unknown) as string);
const result = unpack(event as unknown as string);
expect(result).toEqual(event);
});

Expand Down
Loading