Skip to content

Commit

Permalink
chore(rrweb): Fixed build issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jxiwang committed Oct 18, 2024
1 parent ac683cf commit 41a53cc
Show file tree
Hide file tree
Showing 17 changed files with 33 additions and 68 deletions.
4 changes: 2 additions & 2 deletions packages/all/test/cross-origin-iframe-packer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { unpack } from '@amplitude/rrweb-packer';
import * as fs from 'fs';
import * as path from 'path';
import type * as puppeteer from 'puppeteer';
import type { recordOptions } from 'rrweb';
import type { recordOptions } from '@amplitude/rrweb';
import type {} from'@amplitude/rrweb-types';
import { EventType } from '@amplitude/rrweb-types';
import {
Expand Down Expand Up @@ -57,7 +57,7 @@ async function injectRecordScript(
options?: ExtraOptions,
) {
await frame.addScriptTag({
path: path.resolve(__dirname, '../dist/all.umd.cjs'),
path: path.resolve(__dirname, '../dist/rrweb-all.umd.cjs'),
});
options = options || {};
await frame.evaluate((options) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/all/test/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NodeType } from 'rrweb-snapshot';
import { NodeType } from '@amplitude/rrweb-snapshot';
import { expect } from 'vitest';
import {
EventType,
Expand All @@ -8,7 +8,7 @@ import {
mouseInteractionData,
event,
pluginEvent,
} from '@rrweb/types';
} from '@amplitude/rrweb-types';
import * as puppeteer from 'puppeteer';
import * as path from 'path';
import * as http from 'http';
Expand Down
2 changes: 1 addition & 1 deletion packages/packer/src/pack.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { strFromU8, strToU8, zlibSync } from 'fflate';
import type { PackFn } from '@rrweb/types';
import type { PackFn } from '@amplitude/rrweb-types';
import { eventWithTimeAndPacker, MARK } from './base';

export const pack: PackFn = (event) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@
},
"homepage": "https://github.com/rrweb-io/rrweb#readme",
"devDependencies": {
"rrweb": "^2.0.0-alpha.24",
"@amplitude/rrweb": "^2.0.0-alpha.24",
"typescript": "^4.7.3",
"vite": "^5.2.8",
"vite-plugin-dts": "^3.8.1"
},
"peerDependencies": {
"rrweb": "^2.0.0-alpha.24"
"@amplitude/rrweb": "^2.0.0-alpha.24"
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { RRNode } from '@amplitude/rrdom';
import type { Mirror } from '@amplitude/rrweb-snapshot';
import SimplePeer from 'simple-peer-light';
import type { ReplayPlugin, Replayer } from 'rrweb';
import type { ReplayPlugin, Replayer } from '@amplitude/rrweb';
import type { WebRTCDataChannel } from './types';

// TODO: restrict callback to real nodes only, or make sure callback gets called when real node gets added to dom as well
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,9 @@
"rootDir": "src",
"tsBuildInfoFile": "./tsconfig.tsbuildinfo"
},
"references": []
"references": [
{
"path": "../../rrweb"
}
]
}
2 changes: 1 addition & 1 deletion packages/plugins/rrweb-plugin-console-record/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type {
RecordPlugin,
listenerHandler,
} from '@amplitude/rrweb-types';
import { utils } from 'rrweb';
import { utils } from '@amplitude/rrweb';
import { ErrorStackParser, StackFrame } from './error-stack-parser';
import { stringify } from './stringify';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { eventWithTime } from '@rrweb/types';
import { record } from 'rrweb';
import type { eventWithTime } from '@amplitude/rrweb-types';
import { record } from '@amplitude/rrweb';
import { getRecordConsolePlugin } from '../../src/index';

window.Date.now = () => new Date(Date.UTC(2018, 10, 15, 8)).valueOf();
Expand Down
4 changes: 2 additions & 2 deletions packages/plugins/rrweb-plugin-console-replay/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { eventWithTime } from '@amplitude/rrweb-types';
import { EventType, IncrementalSource } from '@amplitude/rrweb-types';
import type { ReplayPlugin, Replayer } from 'rrweb';
import { LogData, LogLevel, PLUGIN_NAME } from '@rrweb/rrweb-plugin-console-record';
import type { ReplayPlugin, Replayer } from '@amplitude/rrweb';
import { LogData, LogLevel, PLUGIN_NAME } from '@amplitude/rrweb-plugin-console-record';

/**
* define an interface to replay log records
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { eventWithTime } from '@amplitude/rrweb-types';
import type { ReplayPlugin } from 'rrweb';
import type { SequentialIdOptions } from '@rrweb/rrweb-plugin-sequential-id-record';
import type { ReplayPlugin } from '@amplitude/rrweb';
import type { SequentialIdOptions } from '@amplitude/rrweb-plugin-sequential-id-record';

type Options = SequentialIdOptions & {
warnOnMissingId: boolean;
Expand Down
2 changes: 1 addition & 1 deletion packages/record/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { record } from 'rrweb';
import { record } from '@amplitude/rrweb';

export { record };
4 changes: 2 additions & 2 deletions packages/replay/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
type playerConfig,
type PlayerMachineState,
type SpeedMachineState,
} from 'rrweb';
import 'rrweb/dist/style.css';
} from '@amplitude/rrweb';
import '@amplitude/rrweb/dist/style.css';

export { Replayer, playerConfig, PlayerMachineState, SpeedMachineState };
9 changes: 5 additions & 4 deletions packages/rrdom-nodejs/src/document-nodejs.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import { NodeType as RRNodeType } from '@amplitude/rrweb-snapshot';
import type { NWSAPI } from 'nwsapi';
import type { CSSStyleDeclaration as CSSStyleDeclarationType } from 'cssstyle';
import {
BaseRRCDATASection,
BaseRRComment,
Expand All @@ -10,10 +13,8 @@ import {
BaseRRText,
ClassList,
IRRDocument,
CSSStyleDeclaration,
} from '@amplitude/rrdom';
import { NodeType as RRNodeType } from '@amplitude/rrweb-snapshot';
import type { CSSStyleDeclaration as CSSStyleDeclarationType } from 'cssstyle';
import type { NWSAPI } from 'nwsapi';
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-var-requires
const nwsapi = require('nwsapi');
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-var-requires
Expand Down Expand Up @@ -389,4 +390,4 @@ interface RRElementTagNameMap {
}

type RRElementType<K extends keyof HTMLElementTagNameMap> =
K extends keyof RRElementTagNameMap ? RRElementTagNameMap[K] : RRElement;
K extends keyof RRElementTagNameMap ? RRElementTagNameMap[K] : RRElement;
2 changes: 1 addition & 1 deletion packages/rrdom-nodejs/src/polyfill.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BaseRRNode } from 'rrdom';
import { BaseRRNode } from '@amplitude/rrdom';
import { RRDocument } from './document-nodejs';

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/rrdom-nodejs/test/polyfill.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
polyfillDocument,
} from '../src/polyfill';
import { performance as nativePerformance } from 'perf_hooks';
import { BaseRRNode } from 'rrdom';
import { BaseRRNode } from '@amplitude/rrdom';

describe('polyfill for nodejs', () => {
it('should polyfill performance api', () => {
Expand Down
6 changes: 3 additions & 3 deletions packages/rrweb/test/rrdom.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
*/
import { EventType, IncrementalSource, Replayer, eventWithTime } from '../src';
import { vi, type MockInstance } from 'vitest';
import type { styleDeclarationData, styleSheetRuleData } from '@rrweb/types';
import { createMirror, Mirror as NodeMirror } from 'rrweb-snapshot';
import type { ReplayerHandler } from 'rrdom';
import type { styleDeclarationData, styleSheetRuleData } from '@amplitude/rrweb-types';
import { createMirror, Mirror as NodeMirror } from '@amplitude/rrweb-snapshot';
import type { ReplayerHandler } from '@amplitude/rrdom';

describe('diff algorithm for rrdom', () => {
let mirror: NodeMirror;
Expand Down
40 changes: 0 additions & 40 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2654,18 +2654,6 @@
resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.14.1.tgz#299eee74b7d87e116083ac5b1ce8dd9434668294"
integrity sha512-wQGI+LY/Py20zdUPq+XCem7JcPOyzIJBm3dli+56DJsQOHbnXZFEwgmnC6el1TPAfC8lBT3m+z69RmLykNUbew==

"@rrweb/types@^2.0.0-alpha.17":
version "2.0.0-alpha.17"
resolved "https://registry.yarnpkg.com/@rrweb/types/-/types-2.0.0-alpha.17.tgz#bf4af026e767022674892919692d59e766e9368e"
integrity sha512-AfDTVUuCyCaIG0lTSqYtrZqJX39ZEYzs4fYKnexhQ+id+kbZIpIJtaut5cto6dWZbB3SEe4fW0o90Po3LvTmfg==
dependencies:
rrweb-snapshot "^2.0.0-alpha.17"

"@rrweb/utils@^2.0.0-alpha.17":
version "2.0.0-alpha.17"
resolved "https://registry.yarnpkg.com/@rrweb/utils/-/utils-2.0.0-alpha.17.tgz#d13a7326af0311e0f54551e223ace987608eaed5"
integrity sha512-HCsasPERBwOS9/LQeOytO2ETKTCqRj1wORBuxiy3t41hKhmi225DdrUPiWnyDdTQm1GdVbOymMRknJVPnZaSXw==

"@rushstack/[email protected]":
version "4.0.2"
resolved "https://registry.yarnpkg.com/@rushstack/node-core-library/-/node-core-library-4.0.2.tgz#e26854a3314b279d57e8abdb4acce7797d02f554"
Expand Down Expand Up @@ -9735,34 +9723,6 @@ rollup@^4.13.0:
"@rollup/rollup-win32-x64-msvc" "4.14.1"
fsevents "~2.3.2"

rrdom@^2.0.0-alpha.17:
version "2.0.0-alpha.17"
resolved "https://registry.yarnpkg.com/rrdom/-/rrdom-2.0.0-alpha.17.tgz#c200f21a63bab341caea7f3f2f88d760aa045c3a"
integrity sha512-b6caDiNcFO96Opp7TGdcVd4OLGSXu5dJe+A0IDiAu8mk7OmhqZCSDlgQdTKmdO5wMf4zPsUTgb8H/aNvR3kDHA==
dependencies:
rrweb-snapshot "^2.0.0-alpha.17"

rrweb-snapshot@^2.0.0-alpha.17:
version "2.0.0-alpha.17"
resolved "https://registry.yarnpkg.com/rrweb-snapshot/-/rrweb-snapshot-2.0.0-alpha.17.tgz#c4667cbca62530bcb98508e6c85c20f2b320f5ca"
integrity sha512-GBg5pV8LHOTbeVmH2VHLEFR0mc2QpQMzAvcoxEGfPNWgWHc8UvKCyq7pqN1vA+fDZ+yXXbixeO0kB2pzVvFCBw==
dependencies:
postcss "^8.4.38"

rrweb@^2.0.0-alpha.24:
version "2.0.0-alpha.17"
resolved "https://registry.yarnpkg.com/rrweb/-/rrweb-2.0.0-alpha.17.tgz#de4d8bce18c0f184708b79edaa3c974a9f5b843f"
integrity sha512-GQxBkCC4r9XL2bwSdv7iIS49M3cEA8OtObVq0rrQ4GUT4+h7omucGQ4x7m5YN5Vq1oalStBaBlYqF7yRnfG3JA==
dependencies:
"@rrweb/types" "^2.0.0-alpha.17"
"@rrweb/utils" "^2.0.0-alpha.17"
"@types/css-font-loading-module" "0.0.7"
"@xstate/fsm" "^1.4.0"
base64-arraybuffer "^1.0.1"
mitt "^3.0.0"
rrdom "^2.0.0-alpha.17"
rrweb-snapshot "^2.0.0-alpha.17"

run-async@^2.4.0:
version "2.4.1"
resolved "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz"
Expand Down

0 comments on commit 41a53cc

Please sign in to comment.