chore: abstract types to shared package (#1593)

* chore: update types

* small typing change

* fix typing issue

* typed node

* add extra lint skip

* add changeset

---------

Co-authored-by: Eoghan Murray <eoghan@getthere.ie>
Co-authored-by: Justin Halsall <Juice10@users.noreply.github.com>
This commit is contained in:
David Newell
2026-04-01 12:00:00 +08:00
committed by GitHub
parent 97c93a171d
commit 8d634cba97
36 changed files with 256 additions and 250 deletions

View File

@@ -1,11 +1,12 @@
import type { Mirror, serializedNodeWithId } from 'rrweb-snapshot';
import { genId, NodeType } from 'rrweb-snapshot';
import type { Mirror } from 'rrweb-snapshot';
import { genId } from 'rrweb-snapshot';
import type { CrossOriginIframeMessageEvent } from '../types';
import CrossOriginIframeMirror from './cross-origin-iframe-mirror';
import { EventType, IncrementalSource } from '@rrweb/types';
import { EventType, NodeType, IncrementalSource } from '@rrweb/types';
import type {
eventWithTime,
eventWithoutTime,
serializedNodeWithId,
mutationCallBack,
} from '@rrweb/types';
import type { StylesheetManager } from './stylesheet-manager';

View File

@@ -1,4 +1,4 @@
import type { ICanvas, Mirror, DataURLOptions } from 'rrweb-snapshot';
import type { ICanvas, Mirror } from 'rrweb-snapshot';
import type {
blockClass,
canvasManagerMutationCallback,
@@ -8,6 +8,7 @@ import type {
IWindow,
listenerHandler,
CanvasArg,
DataURLOptions,
} from '@rrweb/types';
import { isBlocked } from '../../../utils';
import { CanvasContext } from '@rrweb/types';

View File

@@ -1,6 +1,7 @@
import type { elementNode, serializedNodeWithId } from 'rrweb-snapshot';
import { stringifyRule } from 'rrweb-snapshot';
import type {
elementNode,
serializedNodeWithId,
adoptedStyleSheetCallback,
adoptedStyleSheetParam,
attributeMutation,

View File

@@ -1,6 +1,6 @@
import { encode } from 'base64-arraybuffer';
import type { DataURLOptions } from 'rrweb-snapshot';
import type {
DataURLOptions,
ImageBitmapDataURLWorkerParams,
ImageBitmapDataURLWorkerResponse,
} from '@rrweb/types';

View File

@@ -2,13 +2,10 @@ import {
rebuild,
adaptCssForReplay,
buildNodeWithSN,
NodeType,
type BuildCache,
createCache,
Mirror,
createMirror,
type attributes,
type serializedElementNodeWithId,
toLowerCase,
} from 'rrweb-snapshot';
import {
@@ -40,12 +37,14 @@ import {
} from './machine';
import type { playerConfig, missingNodeMap } from '../types';
import {
NodeType,
EventType,
IncrementalSource,
MouseInteractions,
ReplayerEvents,
} from '@rrweb/types';
import type {
attributes,
fullSnapshotEvent,
eventWithTime,
playerMetaData,
@@ -70,6 +69,7 @@ import type {
styleSheetRuleData,
styleDeclarationData,
adoptedStyleSheetData,
serializedElementNodeWithId,
} from '@rrweb/types';
import {
polyfill,

View File

@@ -1,8 +1,9 @@
import { type Emitter, MediaInteractions, ReplayerEvents } from '@rrweb/types';
import type { Emitter } from '@rrweb/types';
import { MediaInteractions, ReplayerEvents } from '@rrweb/types';
import type { RRMediaElement } from 'rrdom';
import type { createPlayerService, createSpeedService } from '../machine';
import type { Mirror, mediaAttributes } from 'rrweb-snapshot';
import type { mediaInteractionData } from '@rrweb/types';
import type { Mirror } from 'rrweb-snapshot';
import type { mediaInteractionData, mediaAttributes } from '@rrweb/types';
type MediaState = {
isPlaying: boolean;

View File

@@ -4,7 +4,6 @@ import type {
SlimDOMOptions,
MaskInputFn,
MaskTextFn,
DataURLOptions,
} from 'rrweb-snapshot';
import type { IframeManager } from './record/iframe-manager';
import type { ShadowDomManager } from './record/shadow-dom-manager';
@@ -13,6 +12,7 @@ import type { RRNode } from 'rrdom';
import type { CanvasManager } from './record/observers/canvas/canvas-manager';
import type { StylesheetManager } from './record/stylesheet-manager';
import type {
DataURLOptions,
addedNodeMutation,
blockClass,
canvasMutationCallback,

View File

@@ -8,8 +8,9 @@ import type {
IWindow,
DeprecatedMirror,
textMutation,
IMirror,
} from '@rrweb/types';
import type { IMirror, Mirror, SlimDOMOptions } from 'rrweb-snapshot';
import type { Mirror, SlimDOMOptions } from 'rrweb-snapshot';
import { isShadowRoot, IGNORED_NODE, classMatchesRegex } from 'rrweb-snapshot';
import { RRNode, RRIFrameElement, BaseRRNode } from 'rrdom';
import dom from '@rrweb/utils';

View File

@@ -14,8 +14,8 @@ import {
ISuite,
} from './utils';
import type { recordOptions } from '../src/types';
import { eventWithTime, EventType, RecordPlugin } from '@rrweb/types';
import { visitSnapshot, NodeType } from 'rrweb-snapshot';
import { eventWithTime, NodeType, EventType } from '@rrweb/types';
import { visitSnapshot } from 'rrweb-snapshot';
describe('record integration tests', function (this: ISuite) {
vi.setConfig({ testTimeout: 10_000 });

View File

@@ -1,5 +1,5 @@
import { NodeType } from 'rrweb-snapshot';
import {
NodeType,
EventType,
IncrementalSource,
eventWithTime,