Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Correctly import types & css files
  • Loading branch information
Juice10 committed Jun 19, 2024
commit 6bdafa27bdc88f7165ab2ad9fc08359e3dfa8fb3
2 changes: 1 addition & 1 deletion packages/packer/src/pack.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { strFromU8, strToU8, zlibSync } from 'fflate';
import type { PackFn } from '@rrweb/types';
import { eventWithTimeAndPacker, MARK } from './base';
import { type eventWithTimeAndPacker, MARK } from './base';

export const pack: PackFn = (event) => {
const _e: eventWithTimeAndPacker = {
Expand Down
2 changes: 1 addition & 1 deletion packages/packer/src/unpack.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { strFromU8, strToU8, unzlibSync } from 'fflate';
import { eventWithTimeAndPacker, MARK } from './base';
import { type eventWithTimeAndPacker, MARK } from './base';
import type { UnpackFn, eventWithTime } from '@rrweb/types';

export const unpack: UnpackFn = (raw: string) => {
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,6 +1,6 @@
import {
LogLevel,
LogData,
type LogLevel,
type LogData,
PLUGIN_NAME,
} from '@rrweb/rrweb-plugin-console-record';
import type { eventWithTime } from '@rrweb/types';
Expand Down
7 changes: 6 additions & 1 deletion packages/replay/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,9 @@ import {
} from 'rrweb';
import 'rrweb/dist/style.css';

export { Replayer, playerConfig, PlayerMachineState, SpeedMachineState };
export {
Replayer,
type playerConfig,
type PlayerMachineState,
type SpeedMachineState,
};
4 changes: 2 additions & 2 deletions packages/rrdom-nodejs/src/document-nodejs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import {
BaseRRNode,
BaseRRText,
ClassList,
IRRDocument,
CSSStyleDeclaration,
type IRRDocument,
type CSSStyleDeclaration,
} from 'rrdom';
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-var-requires
const nwsapi = require('nwsapi');
Expand Down
2 changes: 1 addition & 1 deletion packages/rrdom/src/diff.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
NodeType as RRNodeType,
Mirror as NodeMirror,
elementNode,
type elementNode,
} from 'rrweb-snapshot';
import type {
canvasMutationData,
Expand Down
12 changes: 6 additions & 6 deletions packages/rrweb-snapshot/src/rebuild.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Rule, Media, NodeWithRules, parse } from './css';
import { type Rule, type Media, type NodeWithRules, parse } from './css';
import {
serializedNodeWithId,
type serializedNodeWithId,
NodeType,
tagMap,
elementNode,
BuildCache,
legacyAttributes,
type tagMap,
type elementNode,
type BuildCache,
type legacyAttributes,
} from './types';
import { isElement, Mirror, isNodeMetaEqual } from './utils';

Expand Down
24 changes: 12 additions & 12 deletions packages/rrweb-snapshot/src/snapshot.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import {
serializedNode,
serializedNodeWithId,
type serializedNode,
type serializedNodeWithId,
NodeType,
attributes,
MaskInputOptions,
SlimDOMOptions,
DataURLOptions,
MaskTextFn,
MaskInputFn,
KeepIframeSrcFn,
ICanvas,
elementNode,
serializedElementNodeWithId,
type attributes,
type MaskInputOptions,
type SlimDOMOptions,
type DataURLOptions,
type MaskTextFn,
type MaskInputFn,
type KeepIframeSrcFn,
type ICanvas,
type elementNode,
type serializedElementNodeWithId,
type mediaAttributes,
} from './types';
import {
Expand Down
4 changes: 2 additions & 2 deletions packages/rrweb-snapshot/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import {
import type {
idNodeMap,
MaskInputFn,
MaskInputOptions,
nodeMetaMap,
IMirror,
serializedNodeWithId,
serializedNode,
NodeType,
documentNode,
documentTypeNode,
textNode,
elementNode,
} from './types';
import { NodeType } from './types';

export function isElement(n: Node): n is Element {
return n.nodeType === n.ELEMENT_NODE;
Expand Down
9 changes: 6 additions & 3 deletions packages/rrweb/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ export {
type eventWithTime,
} from '@rrweb/types';

// exports style.css from replay
import './replay/styles/style.css';

export type { recordOptions, ReplayPlugin } from './types';

const { addCustomEvent } = record;
Expand All @@ -27,9 +30,9 @@ export {
addCustomEvent,
freezePage,
Replayer,
playerConfig,
PlayerMachineState,
SpeedMachineState,
type playerConfig,
type PlayerMachineState,
type SpeedMachineState,
canvasMutation,
_mirror as mirror,
utils,
Expand Down
18 changes: 9 additions & 9 deletions packages/rrweb/src/record/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
snapshot,
MaskInputOptions,
SlimDOMOptions,
type MaskInputOptions,
type SlimDOMOptions,
createMirror,
} from 'rrweb-snapshot';
import { initObservers, mutationBuffers } from './observer';
Expand All @@ -19,14 +19,14 @@ import {
import type { recordOptions } from '../types';
import {
EventType,
eventWithoutTime,
eventWithTime,
type eventWithoutTime,
type eventWithTime,
IncrementalSource,
listenerHandler,
mutationCallbackParam,
scrollCallback,
canvasMutationParam,
adoptedStyleSheetParam,
type listenerHandler,
type mutationCallbackParam,
type scrollCallback,
type canvasMutationParam,
type adoptedStyleSheetParam,
} from '@rrweb/types';
import type { CrossOriginIframeMessageEventContent } from '../types';
import { IframeManager } from './iframe-manager';
Expand Down
12 changes: 7 additions & 5 deletions packages/rrweb/src/record/observer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {
MaskInputOptions,
type MaskInputOptions,
maskInputValue,
Mirror,
getInputType,
Expand All @@ -21,24 +21,26 @@ import {
} from '../utils';
import type { observerParam, MutationBufferParam } from '../types';
import {
IncrementalSource,
MouseInteractions,
PointerTypes,
MediaInteractions,
} from '@rrweb/types';
import type {
mutationCallBack,
mousemoveCallBack,
mousePosition,
mouseInteractionCallBack,
MouseInteractions,
PointerTypes,
listenerHandler,
scrollCallback,
styleSheetRuleCallback,
viewportResizeCallback,
inputValue,
inputCallback,
hookResetter,
IncrementalSource,
hooksParam,
Arguments,
mediaInteractionCallback,
MediaInteractions,
canvasMutationCallback,
fontCallback,
fontParam,
Expand Down
8 changes: 4 additions & 4 deletions packages/rrweb/src/record/observers/canvas/2d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {
blockClass,
type blockClass,
CanvasContext,
canvasManagerMutationCallback,
IWindow,
listenerHandler,
type canvasManagerMutationCallback,
type IWindow,
type listenerHandler,
} from '@rrweb/types';
import { hookSetter, isBlocked, patch } from '../../../utils';
import { serializeArgs } from './serialize-args';
Expand Down
6 changes: 3 additions & 3 deletions packages/rrweb/src/replay/canvas/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { Replayer } from '..';
import {
CanvasContext,
canvasMutationCommand,
canvasMutationData,
canvasMutationParam,
type canvasMutationCommand,
type canvasMutationData,
type canvasMutationParam,
} from '@rrweb/types';
import webglMutation from './webgl';
import canvas2DMutation from './2d';
Expand Down
2 changes: 1 addition & 1 deletion packages/rrweb/src/replay/canvas/webgl.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Replayer } from '../';
import { CanvasContext, canvasMutationCommand } from '@rrweb/types';
import { CanvasContext, type canvasMutationCommand } from '@rrweb/types';
import { deserializeArg, variableListFor } from './deserialize-args';

function getContext(
Expand Down
16 changes: 9 additions & 7 deletions packages/rrweb/src/replay/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import {
rebuild,
buildNodeWithSN,
NodeType,
BuildCache,
type BuildCache,
createCache,
Mirror,
createMirror,
attributes,
serializedElementNodeWithId,
type attributes,
type serializedElementNodeWithId,
toLowerCase,
} from 'rrweb-snapshot';
import {
Expand Down Expand Up @@ -41,15 +41,17 @@ import type { playerConfig, missingNodeMap } from '../types';
import {
EventType,
IncrementalSource,
MouseInteractions,
ReplayerEvents,
} from '@rrweb/types';
import type {
fullSnapshotEvent,
eventWithTime,
MouseInteractions,
playerMetaData,
viewportResizeDimension,
addedNodeMutation,
incrementalSnapshotEvent,
incrementalData,
ReplayerEvents,
Handler,
Emitter,
metaEvent,
Expand All @@ -72,7 +74,7 @@ import {
polyfill,
queueToResolveTrees,
iterateResolveTree,
AppendedIframe,
type AppendedIframe,
getBaseDimension,
hasShadowRoot,
isSerializedIframe,
Expand Down Expand Up @@ -2228,4 +2230,4 @@ export class Replayer {
}
}

export { PlayerMachineState, SpeedMachineState, playerConfig };
export { type PlayerMachineState, type SpeedMachineState, type playerConfig };
11 changes: 8 additions & 3 deletions packages/rrweb/src/replay/machine.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import { createMachine, interpret, assign, StateMachine } from '@xstate/fsm';
import {
createMachine,
interpret,
assign,
type StateMachine,
} from '@xstate/fsm';
import type { playerConfig } from '../types';
import {
eventWithTime,
type eventWithTime,
ReplayerEvents,
EventType,
Emitter,
type Emitter,
IncrementalSource,
} from '@rrweb/types';
import { Timer, addDelay } from './timer';
Expand Down
2 changes: 1 addition & 1 deletion packages/rrweb/src/replay/media/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Emitter, MediaInteractions, ReplayerEvents } from '@rrweb/types';
import { type Emitter, MediaInteractions, ReplayerEvents } from '@rrweb/types';
import type { RRMediaElement } from 'rrdom';
import type { createPlayerService, createSpeedService } from '../machine';
import type { Mirror, mediaAttributes } from 'rrweb-snapshot';
Expand Down
4 changes: 2 additions & 2 deletions packages/rrweb/src/replay/timer.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
actionWithDelay,
eventWithTime,
type actionWithDelay,
type eventWithTime,
EventType,
IncrementalSource,
} from '@rrweb/types';
Expand Down